Boost logo

Boost :

Subject: Re: [boost] Interest in StaticVector - fixed capacity vector
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2011-10-14 12:32:09


Le 14/10/11 17:06, Andrew Hundt a écrit :
> Side note: Can anyone think of a better name than unchecked_push_back?

Hi,

I know that people don't like tags too much, but tags could open the
interface so, the choice of check policy can be deferred at a higher level.

I would use the following overloads:

   void push_back( const T& x );
   void push_back(no_check_t, const T& x);
   void push_back(check_t, const T& x ) {
     return push_back(x);
  }

With this interface we can define an algorithm using push_back that is
templated by the check policy

   template <typename CheckPolicy>
   void algo(...)
   {
     // use push_back(CheckPolicy(), x);
   }

A user could use it also directly as

push_back(no_check, x);

Best,
Vicente


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