
14 Oct
2011
14 Oct
'11
4:32 p.m.
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