Boost logo

Boost :

Subject: Re: [boost] [containers] remarks and questions
From: Pierre Morcello (pmorcell-cppfrance_at_[hidden])
Date: 2011-08-11 18:40:02


Hi Ion,

Thanks for the detailed answer.

>> (Me) There are some examples of containers requiring the value_type
>> to support
>> only the "defaut constructor + a swap() function".
>> This is a concept I would really appreciate to see in
>> boost.containers.
>> In that case, I would very happily use this library.
>> Otherwise I think I will stick with other containers classes.

>Yes, default-contruct only types are supported in many operations, just
>like C++11 requires (say, resize(), emplace()...). I'll add this
>requirement to each function description.

Maybe I was not clear. What I meant was the same as the dlibc++ containers :
being able to use a class like in the following example.
//------------------------------------------------------//
#include <boost/container/vector.hpp>
#include <iostream>

// defaut constructor, swap, and destructor are available, and other
functions are hidden.
class swapOnly
{
public:
        swapOnly():i(0){}
        void swap(swapOnly& p){ std::swap(p.i, i);}
private:
        int i;
        swapOnly(const swapOnly&);
        swapOnly& operator=(const swapOnly&);
};

int main()
{
        boost::container::vector< swapOnly > swapOnlys(3);
        return 0;
}
//------------------------------------------------------//
That is what I meant : a container able also to use only the
value_type::value_type() and value_type::swap() function to implement its
internal operations.

This does not compile. As a consequence, I think such concept is not
supported by boost.containers at the moment. What is your point of view on
that matter ? Did I miss something?

Best regards,

Pierre Morcello

--
View this message in context: http://boost.2283326.n4.nabble.com/boost-containers-remarks-and-questions-tp3728389p3737510.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk