cplusplus / cplusplus/draft

[vector.cons.10] complexity in term of copy constructor calls but T does not need to have constructors LWG4123

Open
#6,733 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

lwg not-editorial
Dominant language
TeX
Stars
221
Forks
813
Avg merge
16h 4m
Merged PRs (30d)
36

Description

https://eel.is/c++draft/vector#cons-10 states:

template<class InputIterator>
  constexpr vector(InputIterator first, InputIterator last,
                   const Allocator& = Allocator());
  • Effects: Constructs a vector equal to the range [first, last), using the specified allocator.
  • Complexity: Makes only N calls to the copy constructor of T (where N is the distance between first and last) and no reallocations if iterators first and last are of forward, bidirectional, or random access categories. It makes order N calls to the copy constructor of T and order logN reallocations if they are just input iterators.

But T does not need to be copy constructible.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading [vector.cons.10] in the C++ draft at eel.is, focusing on the range constructor's Effects and Complexity paragraphs. Check how the stated copy-constructor calls relate to the requirement that T need not be copy constructible. Done means the draft wording accurately describes the constructor without imposing that requirement.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.