Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.std.c++ > #708

Which one(s) of the following std::vector's member functions has the possibility/authority to reduce the vector's capacity?

Message-ID <a0c358e6-1401-48f3-89fa-166a0c93b886@googlegroups.com> (permalink)
Newsgroups comp.std.c++
From goodbyeera@googlemail.com
Subject Which one(s) of the following std::vector's member functions has the possibility/authority to reduce the vector's capacity?
Organization unknown
Date 2014-03-10 01:15 -0600

Show all headers | View raw


For C++11, I have 4 member functions in question:
template <class T, class Allocator = allocator<T> >
class vector {
public:
    vector<T,Allocator>& operator=(const vector<T,Allocator>& x);
    vector<T,Allocator>& operator=(vector<T,Allocator>&& x);
    vector& operator=(initializer_list<T>);
    void clear() noexcept;
};

For C++03, I have 2 member function in question:
template <class T, class Allocator = allocator<T> >
class vector {
public:
    vector<T,Allocator>& operator=(const vector<T,Allocator>& x);
    void clear();
};

Among these member functions, I'm quite confident about the last one,
vector::clear() in C++03, because it's defined in terms of
erase(begin(),end()) which is not allowed to change the capacity.  For
the others, I can't find myself a reliable answer, so I'm asking for
help here.  Relevant excerpts from the standard are highly
appreciated.

Thanks,
goodbyeera


--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]

Back to comp.std.c++ | Previous | NextNext in thread | Find similar


Thread

Which one(s) of the following std::vector's member functions has the  possibility/authority to reduce the vector's capacity? goodbyeera@googlemail.com - 2014-03-10 01:15 -0600
  Re: Which one(s) of the following std::vector's member functions  has the  possibility/authority to reduce the vector's capacity? James Kuyper <jameskuyper@verizon.net> - 2014-03-11 08:16 -0700

csiph-web