1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
void test_moveable(Container cntr,T elem){ Container<T> c; for(long i=0;i<SIZE;++i) c.insert(c.end(),T()); output_static_data(T()); Container<T> c1(c); Container<T> c2(std::move(c)); c1.swap(c2); }
test_moveable(list,MyString); test_moveable(list,MyStrNoMove);
template<typename Container,typename T> void test_moveable(Container cntr,T elem){ typename Container<T> c; for(long i=0;i<SIZE;++i) c.insert(c.end(),T()); output_static_data(T()); Container<T> c1(c); Container<T> c2(std::move(c)); c1.swap(c2); }
test_moveable(list(),MyString()); test_moveable(list(),MyStrNoMove());
template<typename Container> void test_moveable(Container cntr){
typedef typename iterator_traits<typename Container::iterator>::value_type Valtype(); typename Container<T> c; for(long i=0;i<SIZE;++i) c.insert(c.end(),Valtype()); output_static_data(*(c.begin())); Container<T> c1(c); Container<T> c2(std::move(c)); c1.swap(c2); }
test_moveable(list<MyString>()); test_moveable(list<MyStrNoMove>());
|