mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-18 06:42:13 +02:00
Add boost_tuple_iterator_identity to compare iterator correctly.
And add test for boost_tuple_iterator.
This commit is contained in:
@ -42,12 +42,18 @@ namespace boost { namespace fusion
|
||||
struct boost_tuple_is_empty<tuples::tuple<> const> : mpl::true_ {};
|
||||
}
|
||||
|
||||
template <typename Cons>
|
||||
struct boost_tuple_iterator_identity;
|
||||
|
||||
template <typename Cons = tuples::null_type>
|
||||
struct boost_tuple_iterator
|
||||
: iterator_facade<boost_tuple_iterator<Cons>, forward_traversal_tag>
|
||||
{
|
||||
typedef Cons cons_type;
|
||||
|
||||
typedef boost_tuple_iterator_identity<
|
||||
typename add_const<Cons>::type> identity;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
explicit boost_tuple_iterator(Cons& in_cons)
|
||||
: cons(in_cons) {}
|
||||
@ -133,6 +139,11 @@ namespace boost { namespace fusion
|
||||
}
|
||||
};
|
||||
|
||||
template <typename I1, typename I2>
|
||||
struct equal_to
|
||||
: is_same<typename I1::identity, typename I2::identity>
|
||||
{};
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
boost_tuple_iterator& operator= (boost_tuple_iterator const&);
|
||||
@ -144,6 +155,9 @@ namespace boost { namespace fusion
|
||||
{
|
||||
typedef Null cons_type;
|
||||
|
||||
typedef boost_tuple_iterator_identity<
|
||||
typename add_const<Null>::type> identity;
|
||||
|
||||
template <typename I1, typename I2>
|
||||
struct equal_to
|
||||
: mpl::or_<
|
||||
|
@ -60,6 +60,7 @@ project
|
||||
[ run sequence/as_set.cpp : : : : ]
|
||||
[ run sequence/as_vector.cpp : : : : ]
|
||||
[ run sequence/boost_tuple.cpp : : : : ]
|
||||
[ run sequence/boost_tuple_iterator.cpp : : : : ]
|
||||
[ run sequence/cons.cpp : : : : ]
|
||||
[ run sequence/filter_view.cpp : : : : ]
|
||||
[ run sequence/hash.cpp : : : : ]
|
||||
|
21
test/sequence/boost_tuple_iterator.cpp
Normal file
21
test/sequence/boost_tuple_iterator.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2014 Kohei Takahashi
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#include <boost/fusion/adapted/boost_tuple.hpp>
|
||||
|
||||
#define FUSION_SEQUENCE boost::tuple
|
||||
#define FUSION_TRAVERSAL_TAG forward_traversal_tag
|
||||
#define FUSION_NO_PRIOR
|
||||
#include "./iterator.hpp"
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test();
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
Reference in New Issue
Block a user