mardi 4 août 2015

Converting one parameter pack into another?

I would like to convert a parameter pack of iterator types into the corresponding parameter pack of references. This is what I've got so far:

template <class Iterator, class Iterators...>
class cast_iterators_to_references
{
    using head_reference_type = std::iterator_traits<Iterator>::reference

    // TODO
    //using type = ;
};

Where do I take it from here?

The reason I'm doing this is to create a "view" object. It contains a tuple of iterators to the containers it's referencing. I'd like to have a method that returns a tuple of the elements at some index so that I can create a custom iterator for it, create begin and end methods, and use it in a range-based for statement.

Aucun commentaire:

Enregistrer un commentaire