container icon indicating copy to clipboard operation
container copied to clipboard

Support 'pure' (single pass) input_iterators

Open psiha opened this issue 1 year ago • 4 comments

Current assign() implementation from iterator pairs is broken for single-pass iterators (https://en.cppreference.com/w/cpp/iterator/input_iterator) since it assumes that the iterators satisfy at least the forward-iterator requirements (w/o checking those).

psiha avatar Apr 10 '24 10:04 psiha

Boost.Container, at least sequence containers, should support "assign" from input iterators and that is tested in the library tests. Do you have an example that can reproduce the problem?

igaztanaga avatar Jun 13 '24 12:06 igaztanaga

Closing this issue as assign from input iterator is already checked.

igaztanaga avatar Aug 18 '24 22:08 igaztanaga

Boost.Container, at least sequence containers, should support "assign" from input iterators and that is tested in the library tests. Do you have an example that can reproduce the problem?

See here https://github.com/microsoft/STL/blob/b191409cec71aa837072a5d1ebafb041989c71dd/stl/inc/vector#L1245 ...you don't handle the final else 'uncounted range' case.

psiha avatar Aug 19 '24 07:08 psiha

It's implemented using overloads and SFINAE. The function for input iterators is this:

https://github.com/boostorg/container/blob/develop/include/boost/container/vector.hpp#L1320

igaztanaga avatar Aug 19 '24 20:08 igaztanaga

Closing this issue as input iterators are implemented and and tested (https://github.com/boostorg/container/blob/develop/test/vector_test.hpp#L491)

igaztanaga avatar Sep 30 '24 21:09 igaztanaga