On Tue, Dec 24, 2013 at 8:48 PM, Takatoshi Kondo wrote:
typedef boost::any_range int_range;
I realized the problem in my code. int_range doesn't support a
reference. It should be
typedef boost::any_range int_range;
If the boost::iterator_facade is passed the template arguments
boost::random_access_traversal_tag as Traversal and no reference type
as Reference, the iterator_category is input_iterator due to a lack of
reference support.
I checked facade_iterator_category.hpp and wrote the following test
code to clarify my understanding.
#include
struct my_iter:boost::iterator_facade {};
struct my_iter_noref:boost::iterator_facade {};
int main() {
// has reference
static_assert(
std::is_convertible<
std::iterator_traits::iterator_category,
std::random_access_iterator_tag
>::value, "");
// no reference
static_assert(
!std::is_convertible<
std::iterator_traits::iterator_category,
std::random_access_iterator_tag
>::value, "");
static_assert(
std::is_convertible<
std::iterator_traits::iterator_category,
std::input_iterator_tag
>::value, "");
}
Takatoshi Kondo