forked from boostorg/container
* Improved vector's insertion performance.
* Changed again experimental multiallocation interface for better performance (still experimental). * Added no exception support for those willing to disable exceptions in their compilers. * Fixed GCC -Wshadow warnings. * Replaced deprecated BOOST_NO_XXXX with newer BOOST_NO_CXX11_XXX macros. [SVN r81519]
This commit is contained in:
@@ -627,3 +627,77 @@ int main()
|
||||
}
|
||||
|
||||
#include <boost/container/detail/config_end.hpp>
|
||||
|
||||
/*
|
||||
#include <boost/container/map.hpp>
|
||||
#include <boost/container/flat_map.hpp>
|
||||
#include <boost/container/vector.hpp>
|
||||
#include <boost/move/utility.hpp>
|
||||
#include <iostream>
|
||||
|
||||
struct Request
|
||||
{
|
||||
Request() {};
|
||||
|
||||
//Move semantics...
|
||||
Request(BOOST_RV_REF(Request) r) : rvals() //Move constructor
|
||||
{
|
||||
rvals.swap(r.rvals);
|
||||
};
|
||||
|
||||
Request& operator=(BOOST_RV_REF(Request) r) //Move assignment
|
||||
{
|
||||
if (this != &r){
|
||||
rvals.swap(r.rvals);
|
||||
}
|
||||
return *this;
|
||||
};
|
||||
|
||||
// Values I want to be moved, not copied.
|
||||
boost::container::vector<int> rvals;
|
||||
|
||||
private:
|
||||
// Mark this class movable but not copyable
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(Request)
|
||||
};
|
||||
|
||||
typedef boost::container::flat_map<int, Request> Requests;
|
||||
//typedef boost::container::map<int, Request> Requests2;
|
||||
|
||||
int
|
||||
main() {
|
||||
Requests req;
|
||||
std::pair<Requests::iterator, bool> ret = req.insert( Requests::value_type( 7, Request() ) );
|
||||
std::cout << "Insert success for req: " << ret.second << std::endl;
|
||||
|
||||
//Requests2 req2;
|
||||
//std::pair<Requests::iterator, bool> ret2 = req2.insert( Requests2::value_type( 7, Request() ) );
|
||||
//std::cout << "Insert success for req2: " << ret2.second << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <boost/container/flat_set.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(int , char *[])
|
||||
{
|
||||
double d[] = {0, 0.2, 0.8, 1, 2, 3, 4};
|
||||
boost::container::flat_set<double> set;
|
||||
|
||||
set.insert(0);
|
||||
set.insert(set.end(), 1);
|
||||
set.insert(set.end(), 3);
|
||||
set.insert(boost::container::ordered_unique_range_t(), d, d + sizeof(d)/sizeof(*d));
|
||||
boost::container::flat_set<double>::iterator it(set.begin());
|
||||
boost::container::flat_set<double>::iterator const itend(set.end());
|
||||
while(it != itend)
|
||||
cout << *it++ << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
Reference in New Issue
Block a user