Boost logo

Boost Users :

Subject: [Boost-users] boost::range vs && (rvalue ref)
From: Neal Becker (ndbecker2_at_[hidden])
Date: 2013-01-10 21:00:05


Passing range by ref (&) is fine, but using (&&) results in and error. Any
ideas?

#include <boost/range.hpp>
#include <vector>

template<typename out_t>
void F (out_t && o) {
  typedef typename boost::range_value<out_t>::type T;
}

void G() {
  std::vector<int> v;

  F (v);
}

usr/local/src/boost_1_52_0/boost/mpl/eval_if.hpp:60:31: error: no type named
‘type’ in ‘boost::mpl::eval_if_c<false,
boost::range_const_iterator<std::vector<int>&>,
boost::range_mutable_iterator<std::vector<int>&> >::f_ {aka struct
boost::range_mutable_iterator<std::vector<int>&>}’
bug.cc: In instantiation of ‘void F(out_t&&) [with out_t = std::vector<int>&]’:
bug.cc:12:7: required from here
bug.cc:6:52: error: no type named ‘type’ in ‘struct
boost::range_value<std::vector<int>&>’


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