Boost logo

Boost :

Subject: Re: [boost] Interest in flat_iterator for nested containers?
From: Christoph Heindl (christoph.heindl_at_[hidden])
Date: 2009-10-01 03:05:24


Jeff,

you are right. I wonder if non-linear hierarchy can be mapped to a GCD
problem anyway. I guess it is possible for a finite set of
hierarchies, but figuring out is a rather hard job todo. Therefore
I'll switch to a min (or max) problem using consecutive integers.
Another advantage of this is that the hierarchy can be supplied as an
mpl sequence of types and the forward/backward mapping of numbers can
happen implicitely inside widest_convertible:

------
template<class Sequence, class LinearHierarchySequence>
struct widest_convertible {
  typedef typename .... type;
};

typedef mpl::vector<
boost::incrementable_traversal_tag
boost::single_pass_traversal_tag,
boost::forward_traversal_tag,
boost::bidirectional_traversal_tag,
boost::random_access_traversal_tag> linear_hierarchy;

widest_convertible<
 mpl::vector<boost::forward_traversal_tag, boost::bidirectional_traversal_tag>,
 linear_hierarchy>::type t;
-----

Best regards,
Christoph

On Mon, Sep 28, 2009 at 9:48 PM, Jeffrey Hellrung <jhellrung_at_[hidden]> wrote:
> Christoph Heindl wrote:
>>>
>>> Clever!  Though in this instance, the minimum is identical to the gcd, at
>>> which point you could just assign the traversal tags to consecutive
>>> integers
>>> ;)
>>
>> I'm not sure if I understood you correctly: Assigning, for example,
>> 1:readable, 2:single pass and 3:forward iterable would yield
>> 1:readable for the gcd of 2:single pass and 3:foward which is not true
>> (IMHO :).
>
> Oh, I meant that you could replace gcd with min (in a linear hierarchy).
>
> - Jeff
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


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