Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to copy both size and capacity for containers #30

Open
thirtytwobits opened this issue Jun 6, 2023 · 0 comments
Open

Add a way to copy both size and capacity for containers #30

thirtytwobits opened this issue Jun 6, 2023 · 0 comments
Labels
accepted This is an accepted item to be implemented.

Comments

@thirtytwobits
Copy link
Member

Design and implement a way to copy containers that maintains the capacity of the right-hand-size. For example (psedo-ish code):


template<typename LHST, typename RHST>
LHST
capacity_copy_construct(const RHST& rhs)
{
   // default implementation
    LHST a{ rhs };
    a.reserve(rhs.capacity());
    return a;
}

template<>
cetl::VariableLengthArray<std::size_t>
capacity_copy_construct<std::vector<std::size_t>, std::vector<std::size_t>>(const std::vector<std::size_t>& rhs)
{
    // do special stuff here to copy construct VLA with the rhs.capacity()
}

@thirtytwobits thirtytwobits added the accepted This is an accepted item to be implemented. label Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted This is an accepted item to be implemented.
Projects
None yet
Development

No branches or pull requests

1 participant