Пример #1
0
void test<CONTAINER,HANDLER>::insert(unsigned count, bool warm, bool write)
{
  CONTAINER container;
  if (warm) {
    container.push_back(0); container.push_back(0);
    typename CONTAINER::iterator iter = ++container.begin();
    for(unsigned ii = 0; ii != count; ++ii) {
      iter = _handler.insert(container, iter, 1);
      if (ii & 1) ++iter;
    }
    container.clear();
  }
  container.push_back(0); container.push_back(0);
  boost::timer::cpu_timer timer;
  timer.start();
  typename CONTAINER::iterator iter = ++container.begin();
  for(unsigned ii = 0; ii != count; ++ii) {
    iter = _handler.insert(container, iter, 1);
    if (ii & 1) ++iter;
  }
  timer.stop();
  if (write) {
    dump(timer, "middle insert", count, warm);
  }
}
Пример #2
0
void test<CONTAINER,HANDLER>::iterate(unsigned count, bool warm, bool write)
{
  CONTAINER container;
  unsigned unused = 0;
  for(unsigned ii = 0; ii != count; ++ii)
    container.push_back(ii);
  if (warm) {
    for(typename CONTAINER::const_iterator iter = container.begin();
        iter != container.end();
        ++iter)
    {
      unused += *iter;
    }
  }
  boost::timer::cpu_timer timer;
  timer.start();
  for(typename CONTAINER::const_iterator iter = container.begin();
      iter != container.end();
      ++iter)
  {
    unused += *iter;
  }
  timer.stop();
  if (unused == 1234) { // won't happen
    std::cout << "YEAH RIGHT!";
  }
  if (write) {
    dump(timer, "iterate", count, warm);
  }
}
Пример #3
0
bool CBratSettings::LoadRecentFilesGeneric( CONTAINER &paths )
{
	long maxEntries = 0;

	{
		CSection section( mSettings, GROUP_WKS_RECENT );
		auto const &keys = mSettings.childKeys();
        maxEntries = keys.size();
		for ( auto const &key : keys )
		{
			auto value = ReadValue< typename CONTAINER::value_type >( section, q2t< std::string >( key ) );
			paths.push_back( value );
		};
	}

	assert__( paths.size() == maxEntries );			Q_UNUSED( maxEntries );		//for release builds

	return mSettings.status() == QSettings::NoError;
}
Пример #4
0
 virtual void push(any& container, any& element) const
 {
     CONTAINER* c = anycast<CONTAINER*>(container);
     c->push_back(anycast<ELEMENT>(element));
     
 }
Пример #5
0
 void track() { history.push_back(value_); }