Boost logo

Boost Users :

Subject: Re: [Boost-users] [range] range metafunctions and reference types
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2011-08-01 16:29:19


> > template<typename Range>
> >
> > typename range_iterator<typename remove_reference<Range>::type>::type some_function(Range&& r) { ... }
> >
> > Could the range metafunctions be modified to accept range reference parameters and
> > remove the reference themselves?
>
> allthough we should probably be careful here; maybe its better just to say
>
> template< class R >
> auto some_fun( R&& r ) -> decltype(boost::begin(r));

What do we need to be careful about?

IMO this is a case where writing out the return type (range_iterator<R>::type)
is more readable than using decltype.

Regards,
Nate
                                               


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