c++/3402: GCC 3.0 does not compile using push_back function on a vector of pairs of const strings

Artem Khodush artem@duma.gov.ru
Tue Jun 26 00:58:00 GMT 2001


> GCC 3.0 does not compile using push_back function on a vector of pairs of const strings

GCC 3.0 is right, the c++ standard states it pretty clear: anything const 
can not be stored in any kind of standard containers.

  23.1  Container requirements              
...
3 The  type of objects stored in these components must meet the require-
  ments of CopyConstructible types  (_lib.copyconstructible_),  and  the
  additional requirements of Assignable types.

4 In  Table  2,  T is the type used to instantiate the container, t is a
  value of T, and u is a value of (possibly const) T.

                     Table 2--Assignable requirements


            +------------------------------------------------+
            |expression   return type      post-condition    |
            +------------------------------------------------+
            |t = u        T&            t is equivalent to u |
            +------------------------------------------------+





More information about the Gcc-bugs mailing list