forked from boostorg/fusion
minor tweaks
[SVN r36016]
This commit is contained in:
@ -9,7 +9,9 @@
|
|||||||
#define FUSION_ITERATOR_FACADE_09252006_1011
|
#define FUSION_ITERATOR_FACADE_09252006_1011
|
||||||
|
|
||||||
#include <boost/fusion/support/iterator_base.hpp>
|
#include <boost/fusion/support/iterator_base.hpp>
|
||||||
|
#include <boost/fusion/iterator/detail/advance.hpp>
|
||||||
#include <boost/type_traits/is_same.hpp>
|
#include <boost/type_traits/is_same.hpp>
|
||||||
|
#include <boost/mpl/assert.hpp>
|
||||||
|
|
||||||
namespace boost { namespace fusion
|
namespace boost { namespace fusion
|
||||||
{
|
{
|
||||||
@ -22,6 +24,7 @@ namespace boost { namespace fusion
|
|||||||
typedef Derived derived_type;
|
typedef Derived derived_type;
|
||||||
typedef Category category;
|
typedef Category category;
|
||||||
|
|
||||||
|
// default implementation
|
||||||
template <typename I1, typename I2>
|
template <typename I1, typename I2>
|
||||||
struct equal_to // default implementation
|
struct equal_to // default implementation
|
||||||
: is_same<
|
: is_same<
|
||||||
@ -29,6 +32,18 @@ namespace boost { namespace fusion
|
|||||||
, typename I2::derived_type
|
, typename I2::derived_type
|
||||||
>
|
>
|
||||||
{};
|
{};
|
||||||
|
|
||||||
|
// default implementation
|
||||||
|
template <typename Iterator, typename N>
|
||||||
|
struct advance :
|
||||||
|
mpl::if_c<
|
||||||
|
(N::value > 0)
|
||||||
|
, advance_detail::forward<Iterator, N::value>
|
||||||
|
, advance_detail::backward<Iterator, N::value>
|
||||||
|
>::type
|
||||||
|
{
|
||||||
|
BOOST_MPL_ASSERT_NOT((traits::is_random_access<Iterator>));
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
@ -77,14 +77,20 @@ namespace boost { namespace fusion {
|
|||||||
typename add_const<typename mpl::deref<typename Iterator::iterator>::type>,
|
typename add_const<typename mpl::deref<typename Iterator::iterator>::type>,
|
||||||
typename mpl::deref<typename Iterator::iterator>
|
typename mpl::deref<typename Iterator::iterator>
|
||||||
>::type
|
>::type
|
||||||
|
value_type;
|
||||||
|
|
||||||
|
typedef typename
|
||||||
|
add_reference<value_type>::type
|
||||||
type;
|
type;
|
||||||
|
|
||||||
static type
|
static type
|
||||||
call(Iterator const & it)
|
call(Iterator const & it)
|
||||||
{
|
{
|
||||||
typedef typename mpl::deref<typename Iterator::iterator>::type type;
|
typedef typename mpl::deref<typename Iterator::iterator>::type type;
|
||||||
type* result = get<type>(&it.var_);
|
if (type* result = get<type>(&it.var_))
|
||||||
return result ? *result : type();
|
return *result;
|
||||||
|
it.var_ = type(); // prime the variant
|
||||||
|
return *boost::get<type>(&it.var_); // no-throw!
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user