New answers tagged

6

Iterators don't need to be friends with class vector The iterator classes do not need access to private members of vector, so the friend declarations can be removed. Mistakes when using *this There are bugs in your implementation, mainly because you do things like: BDIterator operator++(int) { BDIterator res(*this); ++(*this); return res; } The ...


12

Correctness and testing: First off... note that compilers are not required to do anything with template code unless it's actually used ("instantiation"). Some compilers (or versions of a particular compiler) may check (some) template code for correctness, others may not. So writing a template function, we cannot rely on the compiler to give us a ...


9

Answers template<typename InputIterator, typename = typename std::enable_if<!std::is_integral<InputIterator>::value>::type> vector(InputIterator first, InputIterator last) I can't understand this part: This is using SFINE to make that constructor available or not available depending on the type of the iterator used. If the user of your ...


Top 50 recent answers are included