forked from boostorg/iterator
Avoid 'reference to reference' error in C++03.
Some (strict) C++03 compilers (e.g. `gcc -std=c++03`) reject 'reference-to-reference' in the template and typedef which described in CWG DR106 [1]. In such situations, iterator_facade rejects reference type as a value type and some special iterators will become ill-formed: the test libs/range/test/join.hpp might be descriptive. [1] http://www.open-std.org/Jtc1/sc22/wg21/docs/cwg_defects.html#106 Signed-off-by: Kohei Takahashi <flast@flast.jp>
This commit is contained in:
@ -22,6 +22,7 @@
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/add_pointer.hpp>
|
||||
#include <boost/type_traits/add_lvalue_reference.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
@ -284,7 +285,15 @@ namespace iterators {
|
||||
: mpl::eval_if<
|
||||
mpl::and_<
|
||||
// A proxy is only needed for readable iterators
|
||||
is_convertible<Reference,Value const&>
|
||||
is_convertible<
|
||||
Reference
|
||||
// Use add_lvalue_reference to form `reference to Value` due to
|
||||
// some (strict) C++03 compilers (e.g. `gcc -std=c++03`) reject
|
||||
// 'reference-to-reference' in the template which described in CWG
|
||||
// DR106.
|
||||
// http://www.open-std.org/Jtc1/sc22/wg21/docs/cwg_defects.html#106
|
||||
, typename add_lvalue_reference<Value const>::type
|
||||
>
|
||||
|
||||
// No multipass iterator can have values that disappear
|
||||
// before positions can be re-visited
|
||||
|
Reference in New Issue
Block a user