Example #1
0
bool vector_copyable_only(V1 *boostvector, V2 *stdvector, boost::container::container_detail::true_type)
{
   typedef typename V1::value_type IntType;
   std::size_t size = boostvector->size();
   boostvector->insert(boostvector->end(), 50, IntType(1));
   stdvector->insert(stdvector->end(), 50, 1);
   if(!test::CheckEqualContainers(boostvector, stdvector)) return false;

   {
      IntType move_me(1);
      boostvector->insert(boostvector->begin()+size/2, 50, boost::move(move_me));
      stdvector->insert(stdvector->begin()+size/2, 50, 1);
      if(!test::CheckEqualContainers(boostvector, stdvector)) return false;
   }
   {
      IntType move_me(2);
      boostvector->assign(boostvector->size()/2, boost::move(move_me));
      stdvector->assign(stdvector->size()/2, 2);
      if(!test::CheckEqualContainers(boostvector, stdvector)) return false;
   }
   {
      IntType move_me(3);
      boostvector->assign(boostvector->size()*3-1, boost::move(move_me));
      stdvector->assign(stdvector->size()*3-1, 3);
      if(!test::CheckEqualContainers(boostvector, stdvector)) return false;
   }

   {
      IntType copy_me(3);
      const IntType ccopy_me(3);
      boostvector->push_back(copy_me);
      stdvector->push_back(int(3));
      boostvector->push_back(ccopy_me);
      stdvector->push_back(int(3));
      if(!test::CheckEqualContainers(boostvector, stdvector)) return false;
   }
   {
      V1 *pv1 = new V1(*boostvector);
      V2 *pv2 = new V2(*stdvector);
      boostvector->clear();
      stdvector->clear();
      boostvector->assign(pv1->begin(), pv1->end());
      stdvector->assign(pv2->begin(), pv2->end());
      if(!test::CheckEqualContainers(boostvector, stdvector)) return 1;
      delete pv1;
      delete pv2;
   }

   return true;
}
Example #2
0
bool list_copyable_only(V1 *boostlist, V2 *stdlist, boost::container::container_detail::true_type)
{
   typedef typename V1::value_type IntType;
   boostlist->insert(boostlist->end(), 50, IntType(1));
   stdlist->insert(stdlist->end(), 50, 1);
   if(!test::CheckEqualContainers(boostlist, stdlist)) return false;

   {
      IntType move_me(1);
      boostlist->insert(boostlist->begin(), 50, boost::move(move_me));
      stdlist->insert(stdlist->begin(), 50, 1);
      if(!test::CheckEqualContainers(boostlist, stdlist)) return false;
   }
   {
      IntType move_me(2);
      boostlist->assign(boostlist->size()/2, boost::move(move_me));
      stdlist->assign(stdlist->size()/2, 2);
      if(!test::CheckEqualContainers(boostlist, stdlist)) return false;
   }
   {
      IntType move_me(3);
      boostlist->assign(boostlist->size()*3-1, boost::move(move_me));
      stdlist->assign(stdlist->size()*3-1, 3);
      if(!test::CheckEqualContainers(boostlist, stdlist)) return false;
   }

   {
      IntType copy_me(3);
      const IntType ccopy_me(3);
      boostlist->push_front(copy_me);
      stdlist->push_front(int(3));
      boostlist->push_front(ccopy_me);
      stdlist->push_front(int(3));
      if(!test::CheckEqualContainers(boostlist, stdlist)) return false;
   }

   return true;
}