Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Known Issues

Move emulation limitations in C++03 compilers

Boost.Container uses Boost.Move to implement move semantics both in C++03 and C++11 compilers. However, as explained in Emulation limitations, there are some limitations in C++03 compilers that might surprise Boost.Container users.

The most noticeable problem is when Boost.Container containers are placed in a struct with a compiler-generated assignment operator:

class holder
{
   boost::container::vector<MyType> vect;
};

void func(const holder& h)
{
   holder copy_h(h); //<--- ERROR: can't convert 'const holder&' to 'holder&'
   //Compiler-generated copy constructor is non-const:
   // holder& operator(holder &)
   //!!!
}

This limitation forces the user to define a const version of the copy assignment, in all classes holding containers, which might be annoying in some cases.


PrevUpHomeNext