Skip to content

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

Description

@thirtytwobits

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()
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedThis is an accepted item to be implemented.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions