diff --git a/doc/algorithm.qbk b/doc/algorithm.qbk index fd136f6d..a26637ce 100644 --- a/doc/algorithm.qbk +++ b/doc/algorithm.qbk @@ -1841,6 +1841,50 @@ Constant. Returns a view which is lazily evaluated. [endsect] +[section flatten] + +[heading Description] +Returns a new sequence without nested sequences. + +[heading Synopsis] + template< + typename Sequence + > + typename __result_of_flatten__::type flatten(Sequence& seq); + + template< + typename Sequence + > + typename __result_of_flatten__::type flatten(Sequence const& seq); + +[table Parameters + [[Parameter][Requirement][Description]] + [[`seq`][A model of __forward_sequence__][Operation's argument]] +] + +[heading Expression Semantics] + __flatten__(seq); + +[*Return type]: + +* A model of __forward_sequence__. + +[*Semantics]: Returns a new sequence containing all the leaf elements of `seq`. + +[heading Complexity] +Constant. Returns a view which is lazily evaluated. + +[heading Header] + + #include + #include + +[heading Example] + const __vector__, int> vec(1, 2, __make_vector__(3, 4), 5); + assert(__flatten__(vec) == __make_vector__(1, 2, 3, 4, 5))); + +[endsect] + [endsect] [section Metafunctions] @@ -2633,6 +2677,44 @@ Constant. [endsect] +[section flatten] + +[heading Description] +Returns the result type of __flatten__, given the input sequence type. + +[heading Synopsis] + template< + typename Sequence + > + struct flatten + { + typedef __unspecified__ type; + }; + +[table Parameters + [[Parameter][Requirement][Description]] + [[`Sequence`][A model of __forward_sequence__][Operation's argument]] +] + +[heading Expression Semantics] + __result_of_flatten__::type + +[*Return type]: + +* A model of __forward_sequence__. + +[*Semantics]: Returns a sequence with all the leaf elements of `Sequence`. + +[heading Complexity] +Constant. + +[heading Header] + + #include + #include + +[endsect] + [endsect] [endsect] diff --git a/doc/fusion.qbk b/doc/fusion.qbk index cb7a1820..dce0e3f1 100644 --- a/doc/fusion.qbk +++ b/doc/fusion.qbk @@ -30,7 +30,7 @@ [def __mpl__ [@http://www.boost.org/libs/mpl/index.html MPL]] [def __stl__ [@http://en.wikipedia.org/wiki/Standard_Template_Library STL]] [def __tuple__ [@http://www.boost.org/libs/tuple/doc/tuple_users_guide.html Boost.Tuple]] -[def __tr1__tuple__ [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1403.pdf TR1 Tuple]] +[def __tr1__tuple__ [@http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2002/n1403.pdf TR1 Tuple]] [def __boost_tools__ [@http://www.boost.org/tools/index.html Boost Tools]] [def __spirit_list__ [@https://lists.sourceforge.net/lists/listinfo/spirit-general Spirit Mailing List]] [def __spirit_general__ [@news://news.gmane.org/gmane.comp.spirit.general Spirit General NNTP news portal]] @@ -131,6 +131,7 @@ [def __transform_view__ [link fusion.view.transform_view `transform_view`]] [def __reverse_view__ [link fusion.view.reverse_view `reverse_view`]] [def __zip_view__ [link fusion.view.zip_view `zip_view`]] +[def __flatten_view__ [link fusion.view.flatten_view `flatten_view`]] [def __array__ [link fusion.adapted.array array]] [def __std_pair__ [link fusion.adapted.std__pair `std::pair`]] @@ -288,6 +289,8 @@ [def __result_of_push_back__ [link fusion.algorithm.transformation.metafunctions.push_back `result_of::push_back`]] [def __push_front__ [link fusion.algorithm.transformation.functions.push_front `push_front`]] [def __result_of_push_front__ [link fusion.algorithm.transformation.metafunctions.push_front `result_of::push_front`]] +[def __flatten__ [link fusion.algorithm.transformation.functions.flatten `flatten`]] +[def __result_of_flatten__ [link fusion.algorithm.transformation.metafunctions.flatten `result_of::flatten`]] [def __tr1_tuple_pair__ [link fusion.tuple.pairs `TR1 and std::pair`]] [def __tuple_get__ [link fusion.tuple.class_template_tuple.element_access `get`]] diff --git a/doc/view.qbk b/doc/view.qbk index 62539830..522b2599 100644 --- a/doc/view.qbk +++ b/doc/view.qbk @@ -549,7 +549,6 @@ of the original Fusion __sequence__ [endsect] - [section repetitive_view] [heading Description] @@ -615,4 +614,58 @@ printing a `repetitive_view` to `std::cout` is not. [endsect] +[section flatten_view] + +[heading Description] + +`flatten_view` presents a view which iterates over its elements recursively in depth-first order. + +[heading Header] + + #include + #include + +[heading Synopsis] + + template + struct flatten_view; + +[heading Template parameters] + +[table + [[Parameter] [Description] [Default]] + [[`Sequence`] [A __forward_sequence__] []] +] + +[heading Model of] + +* __forward_sequence__ + +[variablelist Notation + [[`F`] [A `flatten_view` type]] + [[`s`] [An instance of `Sequence`]] + [[`f`, `f2`] [Instances of `F`]] +] + +[heading Expression Semantics] + +Semantics of an expression is defined only where it differs from, or is not +defined in __forward_sequence__. + +[table + [[Expression] [Semantics]] + [[`F(s)`] [Creates a `flatten_view` given sequence, `s`.]] + [[`F(f)`] [Copy constructs a `flatten_view` from another `flatten_view`, `f`.]] + [[`f = f2`] [Assigns to a `flatten_view`, `f`, from another `flatten_view`, `f2`.]] +] + +[heading Example] + typedef __vector__, int> sequence_type; + sequence_type seq; + __flatten_view__ flattened(seq); + __copy__(__make_vector__(1, 2, 3, 4, 5), flattened); + assert(seq == __make_vector__(1, 2, __make_vector__(3, 4), 5)); + +[endsect] + [endsect] diff --git a/include/boost/fusion/algorithm/transformation.hpp b/include/boost/fusion/algorithm/transformation.hpp index 9085846e..b9534e80 100644 --- a/include/boost/fusion/algorithm/transformation.hpp +++ b/include/boost/fusion/algorithm/transformation.hpp @@ -26,6 +26,7 @@ #include #include #include -#include +#include +#include #endif diff --git a/include/boost/fusion/algorithm/transformation/flatten.hpp b/include/boost/fusion/algorithm/transformation/flatten.hpp new file mode 100644 index 00000000..9cd81fa9 --- /dev/null +++ b/include/boost/fusion/algorithm/transformation/flatten.hpp @@ -0,0 +1,44 @@ +/*////////////////////////////////////////////////////////////////////////////// + Copyright (c) 2013 Jamboree + + 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) +//////////////////////////////////////////////////////////////////////////////*/ +#ifndef BOOST_FUSION_ALGORITHM_FLATTEN_HPP_INCLUDED +#define BOOST_FUSION_ALGORITHM_FLATTEN_HPP_INCLUDED + + +#include +#include +#include + + +namespace boost { namespace fusion { namespace result_of +{ + template + struct flatten + { + typedef flatten_view type; + }; +}}} + +namespace boost { namespace fusion +{ + template + inline typename result_of::flatten::type + flatten(Sequence& view) + { + return flatten_view(view); + } + + template + inline typename result_of::flatten::type + flatten(Sequence const& view) + { + return flatten_view(view); + } +}} + + +#endif + diff --git a/include/boost/fusion/include/flatten.hpp b/include/boost/fusion/include/flatten.hpp new file mode 100644 index 00000000..33d73499 --- /dev/null +++ b/include/boost/fusion/include/flatten.hpp @@ -0,0 +1,14 @@ +/*////////////////////////////////////////////////////////////////////////////// + Copyright (c) 2014 Jamboree + + 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) +//////////////////////////////////////////////////////////////////////////////*/ +#ifndef FUSION_INCLUDE_FLATTEN +#define FUSION_INCLUDE_FLATTEN + + +#include + + +#endif diff --git a/include/boost/fusion/include/flatten_view.hpp b/include/boost/fusion/include/flatten_view.hpp new file mode 100644 index 00000000..9a3536b2 --- /dev/null +++ b/include/boost/fusion/include/flatten_view.hpp @@ -0,0 +1,14 @@ +/*////////////////////////////////////////////////////////////////////////////// + Copyright (c) 2014 Jamboree + + 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) +//////////////////////////////////////////////////////////////////////////////*/ +#ifndef FUSION_INCLUDE_FLATTEN_VIEW +#define FUSION_INCLUDE_FLATTEN_VIEW + + +#include + + +#endif diff --git a/include/boost/fusion/include/ref.hpp b/include/boost/fusion/include/ref.hpp new file mode 100644 index 00000000..6a2c8686 --- /dev/null +++ b/include/boost/fusion/include/ref.hpp @@ -0,0 +1,14 @@ +/*////////////////////////////////////////////////////////////////////////////// + Copyright (c) 2014 Jamboree + + 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) +//////////////////////////////////////////////////////////////////////////////*/ +#ifndef FUSION_INCLUDE_REF +#define FUSION_INCLUDE_REF + + +#include + + +#endif diff --git a/include/boost/fusion/support.hpp b/include/boost/fusion/support.hpp index aac610ea..43f42b1b 100644 --- a/include/boost/fusion/support.hpp +++ b/include/boost/fusion/support.hpp @@ -21,5 +21,6 @@ #include #include #include +#include #endif diff --git a/include/boost/fusion/support/ref.hpp b/include/boost/fusion/support/ref.hpp new file mode 100644 index 00000000..775c86b9 --- /dev/null +++ b/include/boost/fusion/support/ref.hpp @@ -0,0 +1,186 @@ +/*////////////////////////////////////////////////////////////////////////////// + Copyright (c) 2013 Jamboree + + 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) +//////////////////////////////////////////////////////////////////////////////*/ +#ifndef BOOST_FUSION_SUPPORT_REF_HPP_INCLUDED +#define BOOST_FUSION_SUPPORT_REF_HPP_INCLUDED + + +#include +#include +#include + + +namespace boost { namespace fusion +{ + struct reference_wrapper_tag; +}} + +namespace boost { namespace fusion { namespace traits +{ + template + struct tag_of > + { + typedef reference_wrapper_tag type; + }; +}}} + +namespace boost { namespace fusion { namespace extension +{ + template + struct category_of_impl; + + template + struct begin_impl; + + template + struct end_impl; + + template + struct at_impl; + + template + struct value_at_impl; + + template + struct size_impl; + + template + struct at_key_impl; + + template + struct value_at_key_impl; + + template + struct has_key_impl; + + template + struct is_sequence_impl; + + template + struct is_view_impl; + + template + struct is_segmented_impl; + + template<> + struct category_of_impl + { + template + struct apply + : category_of_impl::type>:: + template apply + {}; + }; + + template<> + struct begin_impl + { + template + struct apply + : begin_impl::type>:: + template apply + {}; + }; + + template<> + struct end_impl + { + template + struct apply + : end_impl::type>:: + template apply + {}; + }; + + template<> + struct at_impl + { + template + struct apply + : at_impl::type>:: + template apply + {}; + }; + + template<> + struct value_at_impl + { + template + struct apply + : value_at_impl::type>:: + template apply + {}; + }; + + template<> + struct size_impl + { + template + struct apply + : size_impl::type>:: + template apply + {}; + }; + + template<> + struct value_at_key_impl + { + template + struct apply + : value_at_key_impl::type>:: + template apply + {}; + }; + + template<> + struct at_key_impl + { + template + struct apply + : at_key_impl::type>:: + template apply + {}; + }; + + template<> + struct has_key_impl + { + template + struct apply + : has_key_impl::type>:: + template apply + {}; + }; + + template<> + struct is_sequence_impl + { + template + struct apply + : is_sequence_impl::type>:: + template apply + {}; + }; + + template<> + struct is_view_impl + : is_sequence_impl + {}; + + template<> + struct is_segmented_impl + { + template + struct apply + : is_segmented_impl::type>:: + template apply + {}; + }; +}}} + + +#endif + diff --git a/include/boost/fusion/view.hpp b/include/boost/fusion/view.hpp index acf1a813..4cb49122 100644 --- a/include/boost/fusion/view.hpp +++ b/include/boost/fusion/view.hpp @@ -16,5 +16,6 @@ #include #include #include +#include #endif diff --git a/include/boost/fusion/view/flatten_view.hpp b/include/boost/fusion/view/flatten_view.hpp new file mode 100644 index 00000000..dcef08de --- /dev/null +++ b/include/boost/fusion/view/flatten_view.hpp @@ -0,0 +1,15 @@ +/*////////////////////////////////////////////////////////////////////////////// + Copyright (c) 2013 Jamboree + + 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) +//////////////////////////////////////////////////////////////////////////////*/ +#ifndef BOOST_FUSION_SEQUENCE_FLATTEN_VIEW_HPP_INCLUDED +#define BOOST_FUSION_SEQUENCE_FLATTEN_VIEW_HPP_INCLUDED + + +#include +#include + + +#endif diff --git a/include/boost/fusion/view/flatten_view/flatten_view.hpp b/include/boost/fusion/view/flatten_view/flatten_view.hpp new file mode 100644 index 00000000..aa472407 --- /dev/null +++ b/include/boost/fusion/view/flatten_view/flatten_view.hpp @@ -0,0 +1,127 @@ +/*////////////////////////////////////////////////////////////////////////////// + Copyright (c) 2013 Jamboree + + 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) +//////////////////////////////////////////////////////////////////////////////*/ +#ifndef BOOST_FUSION_FLATTEN_VIEW_HPP_INCLUDED +#define BOOST_FUSION_FLATTEN_VIEW_HPP_INCLUDED + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace boost { namespace fusion +{ + struct forward_traversal_tag; + struct flatten_view_tag; + + template + struct flatten_view + : sequence_base > + { + typedef flatten_view_tag fusion_tag; + typedef fusion_sequence_tag tag; // this gets picked up by MPL + typedef mpl::true_ is_view; + typedef forward_traversal_tag category; + + typedef Sequence sequence_type; + typedef typename result_of::begin::type first_type; + typedef typename result_of::end::type last_type; + + explicit flatten_view(Sequence& seq) + : seq(seq) + {} + + first_type first() const { return fusion::begin(seq); } + last_type last() const { return fusion::end(seq); } + + typename mpl::if_, Sequence, Sequence&>::type seq; + }; +}} + +namespace boost { namespace fusion { namespace extension +{ + template<> + struct begin_impl + { + template + struct apply + { + typedef typename Sequence::first_type first_type; + + typedef typename + result_of::begin< + mpl::single_view< + typename Sequence::sequence_type> >::type + root_iterator; + + typedef + detail::seek_descent + seek_descent; + + typedef typename seek_descent::type type; + + static inline + type call(Sequence& seq) + { + return seek_descent::apply(root_iterator(), seq.first()); + } + }; + }; + + template<> + struct end_impl + { + template + struct apply + { + typedef typename Sequence::last_type last_type; + + typedef typename + result_of::end< + mpl::single_view< + typename Sequence::sequence_type> >::type + type; + + static inline + type call(Sequence&) + { + return type(); + } + }; + }; + + template<> + struct size_impl + { + template + struct apply + : result_of::distance + < + typename result_of::begin::type + , typename result_of::end::type + > + {}; + }; + + template<> + struct empty_impl + { + template + struct apply + : result_of::empty + {}; + }; +}}} + + +#endif diff --git a/include/boost/fusion/view/flatten_view/flatten_view_iterator.hpp b/include/boost/fusion/view/flatten_view/flatten_view_iterator.hpp new file mode 100644 index 00000000..dfe613ac --- /dev/null +++ b/include/boost/fusion/view/flatten_view/flatten_view_iterator.hpp @@ -0,0 +1,199 @@ +/*////////////////////////////////////////////////////////////////////////////// + Copyright (c) 2013 Jamboree + + 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) +//////////////////////////////////////////////////////////////////////////////*/ +#ifndef BOOST_FUSION_FLATTEN_VIEW_ITERATOR_HPP_INCLUDED +#define BOOST_FUSION_FLATTEN_VIEW_ITERATOR_HPP_INCLUDED + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace boost { namespace fusion +{ + struct forward_traversal_tag; + struct flatten_view_iterator_tag; + + template + struct flatten_view_iterator + : iterator_base > + { + typedef flatten_view_iterator_tag fusion_tag; + typedef forward_traversal_tag category; + + typedef convert_iterator first_converter; + typedef typename first_converter::type first_type; + typedef Base base_type; + + flatten_view_iterator(First const& first, Base const& base) + : first(first), base(base) + {} + + first_type first; + base_type base; + }; +}} + +namespace boost { namespace fusion { namespace detail +{ + template + struct make_descent_cons + { + typedef cons type; + + static inline type apply(Iterator const& it) + { + return type(it); + } + }; + + template + struct make_descent_cons::type> >::type> + { + // we use 'value_of' above for convenience, assuming the value won't be reference, + // while we must use the regular 'deref' here for const issues... + typedef typename + remove_reference::type>::type + sub_sequence; + + typedef typename + result_of::begin::type + sub_begin; + + typedef cons::type> type; + + static inline type apply(Iterator const& it) + { + return type(it, make_descent_cons::apply( + fusion::begin(*it))); + } + }; + + template + struct build_flatten_view_iterator; + + template + struct build_flatten_view_iterator, Base> + { + typedef flatten_view_iterator type; + + static inline type apply(cons const& cons, Base const& base) + { + return type(cons.car, base); + } + }; + + template + struct build_flatten_view_iterator, Base> + { + typedef flatten_view_iterator next_base; + typedef build_flatten_view_iterator next; + typedef typename next::type type; + + static inline type apply(cons const& cons, Base const& base) + { + return next::apply(cons.cdr, next_base(cons.car, base)); + } + }; + + template + struct seek_descent + { + typedef make_descent_cons make_descent_cons_; + typedef typename make_descent_cons_::type cons_type; + typedef + build_flatten_view_iterator + build_flatten_view_iterator_; + typedef typename build_flatten_view_iterator_::type type; + + static inline type apply(Base const& base, Iterator const& it) + { + return build_flatten_view_iterator_::apply( + make_descent_cons_::apply(it), base); + } + }; + + template + struct seek_descent::type>::type> >::type> + { + typedef typename result_of::next::type type; + + static inline type apply(Base const& base, Iterator const&) + { + return fusion::next(base); + } + }; +}}} + +namespace boost { namespace fusion { namespace extension +{ + template<> + struct next_impl + { + template + struct apply + { + typedef typename Iterator::first_type first_type; + typedef typename Iterator::base_type base_type; + typedef typename result_of::next::type next_type; + + typedef detail::seek_descent seek_descent; + typedef typename seek_descent::type type; + + static inline + type call(Iterator const& it) + { + return seek_descent::apply(it.base, fusion::next(it.first)); + } + }; + }; + + template<> + struct deref_impl + { + template + struct apply + { + typedef typename + result_of::deref::type + type; + + static inline + type call(Iterator const& it) + { + return *it.first; + } + }; + }; + + template<> + struct value_of_impl + { + template + struct apply + { + typedef typename + result_of::value_of::type + type; + }; + }; +}}} + + +#endif + diff --git a/test/Jamfile b/test/Jamfile index d4275f4b..1c84637d 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -54,6 +54,7 @@ project [ run algorithm/zip.cpp : : : : ] [ run algorithm/zip2.cpp : : : : ] [ run algorithm/zip_ignore.cpp : : : : ] + [ run algorithm/flatten.cpp : : : : ] [ run sequence/as_list.cpp : : : : ] [ run sequence/as_map.cpp : : : : ] @@ -151,6 +152,7 @@ project [ run sequence/define_assoc_tpl_struct.cpp : : : : ] [ run sequence/std_tuple_iterator.cpp : : : : ] [ run sequence/ref_vector.cpp : : : : ] + [ run sequence/flatten_view.cpp : : : : ] [ run functional/fused.cpp : : : : ] [ run functional/fused_function_object.cpp : : : : ] diff --git a/test/algorithm/flatten.cpp b/test/algorithm/flatten.cpp new file mode 100644 index 00000000..28d6359f --- /dev/null +++ b/test/algorithm/flatten.cpp @@ -0,0 +1,57 @@ +/*////////////////////////////////////////////////////////////////////////////// + Copyright (c) 2013 Jamboree + + 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +int main() +{ + using namespace boost::fusion; + + { + typedef vector, int> sequence_type; + sequence_type seq(1, 2, make_vector(3, 4), 5); + + BOOST_TEST((boost::fusion::size(flatten(seq)) == 5)); + } + + { + typedef vector, int> sequence_type; + sequence_type seq(1, 2, make_vector(3, 4), 5); + std::cout << flatten(seq) << std::endl; + BOOST_TEST((flatten(seq) == make_vector(1, 2, 3, 4, 5))); + } + + { + std::cout << flatten(make_vector(1, 2, make_vector(3, 4), 5)) << std::endl; + BOOST_TEST((flatten(make_vector(1, 2, make_vector(3, 4), 5)) == make_vector(1, 2, 3, 4, 5))); + } + + { + typedef vector, int> sequence_type; + sequence_type seq; + result_of::flatten::type flat(flatten(seq)); + copy(make_vector(1, 2, 3, 4, 5), flat); + std::cout << seq << std::endl; + BOOST_TEST((seq == make_vector(1, 2, make_vector(3, 4), 5))); + } + + return boost::report_errors(); +} + diff --git a/test/sequence/flatten_view.cpp b/test/sequence/flatten_view.cpp new file mode 100644 index 00000000..f24c1d95 --- /dev/null +++ b/test/sequence/flatten_view.cpp @@ -0,0 +1,56 @@ +/*////////////////////////////////////////////////////////////////////////////// + Copyright (c) 2013 Jamboree + + 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +int main() +{ + using namespace boost::fusion; + + { + typedef vector, int> sequence_type; + sequence_type seq(1, 2, make_vector(3, 4), 5); + flatten_view flattened(seq); + + BOOST_TEST((boost::fusion::size(flattened) == 5)); + BOOST_TEST((boost::fusion::distance(boost::fusion::begin(flattened), boost::fusion::end(flattened)) == 5)); + } + + { + typedef vector, int> sequence_type; + sequence_type seq(1, 2, make_vector(3, 4), 5); + flatten_view flattened(seq); + std::cout << flattened << std::endl; + BOOST_TEST((flattened == make_vector(1, 2, 3, 4, 5))); + BOOST_TEST((*advance_c<2>(boost::fusion::begin(flattened)) == 3)); + } + + { + typedef vector, int> sequence_type; + sequence_type seq; + flatten_view flattened(seq); + copy(make_vector(1, 2, 3, 4, 5), flattened); + std::cout << seq << std::endl; + BOOST_TEST((seq == make_vector(1, 2, make_vector(3, 4), 5))); + } + + return boost::report_errors(); +} +