From 159426b8af50871af92976c4ee45a6f4c32a5608 Mon Sep 17 00:00:00 2001 From: Joel de Guzman Date: Sat, 24 Sep 2011 13:07:24 +0000 Subject: [PATCH] Added adapter for std::tuple (only for implementations using variadic templates) [SVN r74547] --- test/Jamfile | 1 + test/sequence/iterator.hpp | 4 ++-- test/sequence/std_tuple_iterator.cpp | 35 ++++++++++++++++++++++++++++ test/sequence/vector_iterator.cpp | 2 +- 4 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 test/sequence/std_tuple_iterator.cpp diff --git a/test/Jamfile b/test/Jamfile index 9cb6120d..3cea5ecf 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -135,6 +135,7 @@ import testing ; [ run sequence/define_assoc_struct.cpp : : : : ] [ run sequence/define_tpl_struct.cpp : : : : ] [ run sequence/define_assoc_tpl_struct.cpp : : : : ] + [ run sequence/std_tuple_iterator.cpp : : : : ] [ run functional/fused.cpp : : : : ] [ run functional/fused_function_object.cpp : : : : ] diff --git a/test/sequence/iterator.hpp b/test/sequence/iterator.hpp index d88b7199..ab29b8a0 100644 --- a/test/sequence/iterator.hpp +++ b/test/sequence/iterator.hpp @@ -1,7 +1,7 @@ /*============================================================================= Copyright (c) 2001-2011 Joel de Guzman - Distributed under the Boost Software License, Version 1.0. (See accompanying + 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 @@ -113,7 +113,7 @@ void test() BOOST_TEST(*next(next(next(i))) == s); next(next(next(next(i)))); // end - + #ifdef FUSION_TEST_FAIL next(next(next(next(next(i))))); // past the end: must not compile #endif diff --git a/test/sequence/std_tuple_iterator.cpp b/test/sequence/std_tuple_iterator.cpp new file mode 100644 index 00000000..1592eef5 --- /dev/null +++ b/test/sequence/std_tuple_iterator.cpp @@ -0,0 +1,35 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + + 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 + +// The std_tuple_iterator adaptor only supports implementations +// using variadic templates +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +#include + +#define FUSION_SEQUENCE std::tuple +#define FUSION_TRAVERSAL_TAG random_access_traversal_tag +#include "./iterator.hpp" + +int +main() +{ + test(); + return boost::report_errors(); +} + +#else + +int +main() +{ + return 0; +} + +#endif + diff --git a/test/sequence/vector_iterator.cpp b/test/sequence/vector_iterator.cpp index 4d4b6b39..a2ca7df7 100644 --- a/test/sequence/vector_iterator.cpp +++ b/test/sequence/vector_iterator.cpp @@ -1,7 +1,7 @@ /*============================================================================= Copyright (c) 2001-2011 Joel de Guzman - Distributed under the Boost Software License, Version 1.0. (See accompanying + 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