Boost logo

Boost Users :

From: HighCommander4 (zeratul976_at_[hidden])
Date: 2007-08-29 00:11:48


Let's say I had a function

template <typename Iterator>
void function(Iterator first, Iterator last);

and I want it to call two different functions based on if Iterator is a
random access iterator or just a forward iterator. Essentially, I want two
versions of this function:

template <typename RandomAccessIterator>
void function(RandomAccessIterator first, RandomAccessIterator last);

template <typename ForwardIterator>
void function(ForwardIterator first, ForwardIterator last);

I want a function call to function(a, b) to translate to the first one if a
and b are random access iterators, and the second one if they are not.

I'm thinking of somehow combining enable_if and concept checking, I'm just
not sure how...

-- 
View this message in context: http://www.nabble.com/Different-functions-based-on-type-of-iterator--tf4345502.html#a12380133
Sent from the Boost - Users mailing list archive at Nabble.com.

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net