On 04/23/2014 06:51 PM, Albert Yiamakis wrote:
I'm not sure if there is something special about your use-case that stops method 2 from working. Perhaps you could take a look at the MFC support in Boost.Range to see if this helps you add support for your classes.
If you can provide some code that shows the classes you are trying to make support ranges then I'd be happy to try and help.
A simple example:
class Base {/* stuff */}; //it is in fact an abstract base class but shouldn't matter
class Iterator {/* stuff */ }; //will be used to iterate - assume the default constructed represents end
Now I 'd like all classes that derive from Base to model a Range. I have only been able to do this by adding the additional template parameter myself, then this is possible:
namespace boost {
template <typename C> struct range_iterator
>::type> { typedef Iterator type; }; template<typename C> struct range_const_iterator
::type> { typedef Iterator type; }; }
Would something like
template <typename C>
struct range_iterator