Skip to content

Implement homework_4: ipb::named_vector and ipb algorithm functions#2

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/vscode-mnxk9z1b-nlw7
Draft

Implement homework_4: ipb::named_vector and ipb algorithm functions#2
Copilot wants to merge 4 commits into
mainfrom
copilot/vscode-mnxk9z1b-nlw7

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 13, 2026

homework_4/include/homework_4.h was empty and homework_4/ had no CMakeLists.txt, causing the entire test suite to fail to compile.

Added: homework_4/include/homework_4.h

  • ipb::named_vector<T> — template wrapper around std::vector<T> with a string name:
    • empty()true when either name or vector is empty
    • size()name.size() + vector.size()
    • capacity() / resize() / reserve() delegate to the inner vector
  • Algorithm free functions in namespace ipb:
    accumulate, count, all_even, clamp, fill, find, print, toupper, sort, rotate (bounds-normalised), reverse
ipb::named_vector<int> v{"scores", {3, 1, 4, 1, 5}};
v.size();           // 6 (name) + 5 (vec) = 11
v.empty();          // false — both name and data present

ipb::sort(v);
v.vector();         // {1, 1, 3, 4, 5}

ipb::toupper(v);
v.name();           // "SCORES"

Added: homework_4/CMakeLists.txt

Defines ipb_algorithm as a CMake INTERFACE (header-only) library so the test target can link against it.

Updated: homework_4/tests/

Catch2 v3 compatibility: <catch2/catch.hpp><catch2/catch_all.hpp>, dropped CATCH_CONFIG_MAIN, switched link target to Catch2::Catch2WithMain.

Original prompt

explain this error?

The user has attached the following file paths as relevant context:

  • homework_4/include/homework_4.h

Created from VS Code.

Copilot AI changed the title [WIP] Explain error in homework 4 header file Implement homework_4: ipb::named_vector and ipb algorithm functions Apr 13, 2026
Copilot AI requested a review from zappateinstein April 13, 2026 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants