diff --git a/include/boost/fusion/support/is_view.hpp b/include/boost/fusion/support/is_view.hpp index a6ca7259..b2b52c42 100644 --- a/include/boost/fusion/support/is_view.hpp +++ b/include/boost/fusion/support/is_view.hpp @@ -14,6 +14,7 @@ namespace boost { namespace fusion { // Special tags: + struct non_fusion_tag; struct sequence_facade_tag; struct boost_tuple_tag; // boost::tuples::tuple tag struct boost_array_tag; // boost::array tag @@ -32,6 +33,13 @@ namespace boost { namespace fusion }; }; + template <> + struct is_view_impl + { + template + struct apply : mpl::false_ {}; + }; + template <> struct is_view_impl { diff --git a/test/Jamfile b/test/Jamfile index c880b984..e55b15ad 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -257,6 +257,7 @@ project [ run sequence/swap.cpp ] [ compile support/is_sequence.cpp ] + [ compile support/is_view.cpp ] [ compile support/pair_deque.cpp ] [ compile support/pair_list.cpp ] [ compile support/pair_map.cpp ] diff --git a/test/sequence/adapt_adt.cpp b/test/sequence/adapt_adt.cpp index 98958348..12404d12 100644 --- a/test/sequence/adapt_adt.cpp +++ b/test/sequence/adapt_adt.cpp @@ -165,6 +165,7 @@ main() { BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); ns::point p(123, 456, 789); std::cout << at_c<0>(p) << std::endl; @@ -237,6 +238,7 @@ main() #if !BOOST_WORKAROUND(__GNUC__,<4) { BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); ns::point_with_private_members p(123, 456, 789); std::cout << at_c<0>(p) << std::endl; diff --git a/test/sequence/adapt_adt_empty.cpp b/test/sequence/adapt_adt_empty.cpp index 925cdce0..03e786b7 100644 --- a/test/sequence/adapt_adt_empty.cpp +++ b/test/sequence/adapt_adt_empty.cpp @@ -42,6 +42,7 @@ main() { BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); empty_adt e; std::cout << e << std::endl; diff --git a/test/sequence/adapt_adt_named.cpp b/test/sequence/adapt_adt_named.cpp index 6ed9e1d2..19d2d8b1 100644 --- a/test/sequence/adapt_adt_named.cpp +++ b/test/sequence/adapt_adt_named.cpp @@ -93,6 +93,7 @@ main() { BOOST_MPL_ASSERT((traits::is_view)); + BOOST_STATIC_ASSERT(traits::is_view::value); ns::point basep(123, 456, 789); adapted::point p(basep); diff --git a/test/sequence/adapt_adt_named_empty.cpp b/test/sequence/adapt_adt_named_empty.cpp index f750071d..c7fa2033 100644 --- a/test/sequence/adapt_adt_named_empty.cpp +++ b/test/sequence/adapt_adt_named_empty.cpp @@ -43,6 +43,7 @@ main() empty_adt empty; { BOOST_MPL_ASSERT((traits::is_view)); + BOOST_STATIC_ASSERT(traits::is_view::value); adapted::empty_adt e(empty); std::cout << e << std::endl; diff --git a/test/sequence/adapt_assoc_adt.cpp b/test/sequence/adapt_assoc_adt.cpp index 02c7afa2..a0dc2232 100644 --- a/test/sequence/adapt_assoc_adt.cpp +++ b/test/sequence/adapt_assoc_adt.cpp @@ -84,6 +84,7 @@ main() { BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); ns::point p(123, 456, 789); std::cout << at_c<0>(p) << std::endl; diff --git a/test/sequence/adapt_assoc_adt_empty.cpp b/test/sequence/adapt_assoc_adt_empty.cpp index 8d4d2a28..26cd9857 100644 --- a/test/sequence/adapt_assoc_adt_empty.cpp +++ b/test/sequence/adapt_assoc_adt_empty.cpp @@ -42,6 +42,7 @@ main() { BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); empty_adt e; std::cout << e << std::endl; diff --git a/test/sequence/adapt_assoc_adt_named.cpp b/test/sequence/adapt_assoc_adt_named.cpp index 0fcdbb99..ecdd9028 100644 --- a/test/sequence/adapt_assoc_adt_named.cpp +++ b/test/sequence/adapt_assoc_adt_named.cpp @@ -80,6 +80,7 @@ main() { BOOST_MPL_ASSERT((traits::is_view)); + BOOST_STATIC_ASSERT(traits::is_view::value); ns::point basep(123, 456); adapted::point p(basep); diff --git a/test/sequence/adapt_assoc_adt_named_empty.cpp b/test/sequence/adapt_assoc_adt_named_empty.cpp index c8fa102a..e2e26800 100644 --- a/test/sequence/adapt_assoc_adt_named_empty.cpp +++ b/test/sequence/adapt_assoc_adt_named_empty.cpp @@ -43,6 +43,7 @@ main() empty_adt empty; { BOOST_MPL_ASSERT((traits::is_view)); + BOOST_STATIC_ASSERT(traits::is_view::value); adapted::empty_adt e(empty); std::cout << e << std::endl; diff --git a/test/sequence/adapt_assoc_struct.cpp b/test/sequence/adapt_assoc_struct.cpp index 8d59acc0..6266e95f 100644 --- a/test/sequence/adapt_assoc_struct.cpp +++ b/test/sequence/adapt_assoc_struct.cpp @@ -86,6 +86,7 @@ main() { BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); ns::point p = {123, 456, 789}; std::cout << at_c<0>(p) << std::endl; diff --git a/test/sequence/adapt_assoc_struct_empty.cpp b/test/sequence/adapt_assoc_struct_empty.cpp index aa75f87a..c7cadf94 100644 --- a/test/sequence/adapt_assoc_struct_empty.cpp +++ b/test/sequence/adapt_assoc_struct_empty.cpp @@ -42,6 +42,7 @@ main() { BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); empty_struct e; std::cout << e << std::endl; diff --git a/test/sequence/adapt_assoc_struct_named.cpp b/test/sequence/adapt_assoc_struct_named.cpp index 585942cd..96606787 100644 --- a/test/sequence/adapt_assoc_struct_named.cpp +++ b/test/sequence/adapt_assoc_struct_named.cpp @@ -66,6 +66,7 @@ main() { BOOST_MPL_ASSERT((traits::is_view)); + BOOST_STATIC_ASSERT(traits::is_view::value); ns::point basep = {123, 456}; adapted::point p(basep); diff --git a/test/sequence/adapt_assoc_struct_named_empty.cpp b/test/sequence/adapt_assoc_struct_named_empty.cpp index a744d6a4..a1783fd3 100644 --- a/test/sequence/adapt_assoc_struct_named_empty.cpp +++ b/test/sequence/adapt_assoc_struct_named_empty.cpp @@ -43,6 +43,7 @@ main() empty_struct empty; { BOOST_MPL_ASSERT((traits::is_view)); + BOOST_STATIC_ASSERT(traits::is_view::value); adapted::empty_struct e(empty); std::cout << e << std::endl; diff --git a/test/sequence/adapt_assoc_tpl_adt.cpp b/test/sequence/adapt_assoc_tpl_adt.cpp index 63a358d6..f416f46a 100644 --- a/test/sequence/adapt_assoc_tpl_adt.cpp +++ b/test/sequence/adapt_assoc_tpl_adt.cpp @@ -98,6 +98,7 @@ main() { BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); point p(123, 456, 789); std::cout << at_c<0>(p) << std::endl; diff --git a/test/sequence/adapt_assoc_tpl_struct.cpp b/test/sequence/adapt_assoc_tpl_struct.cpp index cd275024..49f42c5d 100644 --- a/test/sequence/adapt_assoc_tpl_struct.cpp +++ b/test/sequence/adapt_assoc_tpl_struct.cpp @@ -96,6 +96,7 @@ main() { BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); point p = {123, 456, 789.43f}; std::cout << at_c<0>(p) << std::endl; diff --git a/test/sequence/adapt_struct.cpp b/test/sequence/adapt_struct.cpp index c0f07d0d..3518ff41 100644 --- a/test/sequence/adapt_struct.cpp +++ b/test/sequence/adapt_struct.cpp @@ -170,6 +170,7 @@ main() { BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); point p = {123, 456, 789}; std::cout << at_c<0>(p) << std::endl; diff --git a/test/sequence/adapt_struct_empty.cpp b/test/sequence/adapt_struct_empty.cpp index f08dc98d..202131d4 100644 --- a/test/sequence/adapt_struct_empty.cpp +++ b/test/sequence/adapt_struct_empty.cpp @@ -42,6 +42,7 @@ main() { BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); empty_struct e; std::cout << e << std::endl; diff --git a/test/sequence/adapt_struct_named.cpp b/test/sequence/adapt_struct_named.cpp index 9f4c7bc2..ec5cf7ba 100644 --- a/test/sequence/adapt_struct_named.cpp +++ b/test/sequence/adapt_struct_named.cpp @@ -87,6 +87,7 @@ main() { BOOST_MPL_ASSERT((traits::is_view)); + BOOST_STATIC_ASSERT(traits::is_view::value); ns::point basep = {123, 456, 789}; adapted::point p(basep); diff --git a/test/sequence/adapt_struct_named_empty.cpp b/test/sequence/adapt_struct_named_empty.cpp index 8333f130..7272f6f6 100644 --- a/test/sequence/adapt_struct_named_empty.cpp +++ b/test/sequence/adapt_struct_named_empty.cpp @@ -43,6 +43,7 @@ main() empty_struct empty; { BOOST_MPL_ASSERT((traits::is_view)); + BOOST_STATIC_ASSERT(traits::is_view::value); adapted::empty_struct e(empty); std::cout << e << std::endl; diff --git a/test/sequence/adapt_tpl_adt.cpp b/test/sequence/adapt_tpl_adt.cpp index 3cb5e8aa..d917134a 100644 --- a/test/sequence/adapt_tpl_adt.cpp +++ b/test/sequence/adapt_tpl_adt.cpp @@ -107,6 +107,7 @@ main() { BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); point p(123, 456, 789); std::cout << at_c<0>(p) << std::endl; diff --git a/test/sequence/adapt_tpl_struct.cpp b/test/sequence/adapt_tpl_struct.cpp index a5514681..1776cd62 100644 --- a/test/sequence/adapt_tpl_struct.cpp +++ b/test/sequence/adapt_tpl_struct.cpp @@ -96,6 +96,7 @@ main() { BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); point p = {123, 456, 789}; std::cout << at_c<0>(p) << std::endl; diff --git a/test/sequence/array.cpp b/test/sequence/array.cpp index 15b4ed89..ca4a40ac 100644 --- a/test/sequence/array.cpp +++ b/test/sequence/array.cpp @@ -22,6 +22,8 @@ int main() BOOST_MPL_ASSERT((traits::is_sequence)); BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(traits::is_sequence::value); + BOOST_STATIC_ASSERT(!traits::is_view::value); array_type arr = {1,2,3}; diff --git a/test/sequence/boost_array.cpp b/test/sequence/boost_array.cpp index a1bb6542..f3f71470 100644 --- a/test/sequence/boost_array.cpp +++ b/test/sequence/boost_array.cpp @@ -26,6 +26,8 @@ int main() BOOST_MPL_ASSERT((traits::is_sequence)); BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(traits::is_sequence::value); + BOOST_STATIC_ASSERT(!traits::is_view::value); array_type arr = {{1,2,3}}; diff --git a/test/sequence/boost_tuple.cpp b/test/sequence/boost_tuple.cpp index 7d19ffef..abe7d3c8 100644 --- a/test/sequence/boost_tuple.cpp +++ b/test/sequence/boost_tuple.cpp @@ -46,6 +46,7 @@ main() { typedef boost::tuple tuple_type; BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); tuple_type t(123, "Hola!!!"); std::cout << at_c<0>(t) << std::endl; diff --git a/test/sequence/define_assoc_struct.cpp b/test/sequence/define_assoc_struct.cpp index 90608c40..231621f8 100644 --- a/test/sequence/define_assoc_struct.cpp +++ b/test/sequence/define_assoc_struct.cpp @@ -42,6 +42,7 @@ main() { BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); ns::point p(123, 456); std::cout << at_c<0>(p) << std::endl; diff --git a/test/sequence/define_assoc_struct_empty.cpp b/test/sequence/define_assoc_struct_empty.cpp index 204eda8e..91dd2f35 100644 --- a/test/sequence/define_assoc_struct_empty.cpp +++ b/test/sequence/define_assoc_struct_empty.cpp @@ -30,6 +30,7 @@ main() { BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); empty_struct e; std::cout << e << std::endl; diff --git a/test/sequence/define_assoc_tpl_struct.cpp b/test/sequence/define_assoc_tpl_struct.cpp index 00b3b1ce..bdbcfe47 100644 --- a/test/sequence/define_assoc_tpl_struct.cpp +++ b/test/sequence/define_assoc_tpl_struct.cpp @@ -46,6 +46,7 @@ main() { BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); point p(123, 456); std::cout << at_c<0>(p) << std::endl; diff --git a/test/sequence/define_assoc_tpl_struct_empty.cpp b/test/sequence/define_assoc_tpl_struct_empty.cpp index fc4ebd7f..70d6ca50 100644 --- a/test/sequence/define_assoc_tpl_struct_empty.cpp +++ b/test/sequence/define_assoc_tpl_struct_empty.cpp @@ -30,6 +30,7 @@ main() { BOOST_MPL_ASSERT_NOT((traits::is_view >)); + BOOST_STATIC_ASSERT(!traits::is_view >::value); empty_struct e; std::cout << e << std::endl; diff --git a/test/sequence/define_struct.cpp b/test/sequence/define_struct.cpp index 51a40564..1243b9fe 100644 --- a/test/sequence/define_struct.cpp +++ b/test/sequence/define_struct.cpp @@ -54,6 +54,7 @@ main() { BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); ns::point p(123, 456); std::cout << at_c<0>(p) << std::endl; diff --git a/test/sequence/define_struct_empty.cpp b/test/sequence/define_struct_empty.cpp index 893ed436..1468b917 100644 --- a/test/sequence/define_struct_empty.cpp +++ b/test/sequence/define_struct_empty.cpp @@ -30,6 +30,7 @@ main() { BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); empty_struct e; std::cout << e << std::endl; diff --git a/test/sequence/define_struct_inline.cpp b/test/sequence/define_struct_inline.cpp index 3a902372..4a3793b7 100644 --- a/test/sequence/define_struct_inline.cpp +++ b/test/sequence/define_struct_inline.cpp @@ -66,6 +66,7 @@ void run_test() { BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); Point p(123, 456); std::cout << at_c<0>(p) << std::endl; diff --git a/test/sequence/define_struct_inline_empty.cpp b/test/sequence/define_struct_inline_empty.cpp index 4524da1b..4168770a 100644 --- a/test/sequence/define_struct_inline_empty.cpp +++ b/test/sequence/define_struct_inline_empty.cpp @@ -30,6 +30,7 @@ main() { BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); empty_struct e; std::cout << e << std::endl; diff --git a/test/sequence/define_tpl_struct.cpp b/test/sequence/define_tpl_struct.cpp index bb5bf96e..b47ac611 100644 --- a/test/sequence/define_tpl_struct.cpp +++ b/test/sequence/define_tpl_struct.cpp @@ -42,6 +42,7 @@ main() { BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); point p(123, 456); std::cout << at_c<0>(p) << std::endl; diff --git a/test/sequence/define_tpl_struct_inline.cpp b/test/sequence/define_tpl_struct_inline.cpp index 18fdb0d1..3a7c69e3 100644 --- a/test/sequence/define_tpl_struct_inline.cpp +++ b/test/sequence/define_tpl_struct_inline.cpp @@ -61,6 +61,7 @@ void run_test() { BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); Point p(123, 456); std::cout << at_c<0>(p) << std::endl; diff --git a/test/sequence/set.cpp b/test/sequence/set.cpp index cf97c100..714c36cd 100644 --- a/test/sequence/set.cpp +++ b/test/sequence/set.cpp @@ -89,6 +89,9 @@ main() BOOST_MPL_ASSERT((traits::is_sequence)); BOOST_MPL_ASSERT((traits::is_sequence)); BOOST_MPL_ASSERT((traits::is_sequence)); + BOOST_STATIC_ASSERT(traits::is_sequence::value); + BOOST_STATIC_ASSERT(traits::is_sequence::value); + BOOST_STATIC_ASSERT(traits::is_sequence::value); } { // testing mpl::is_sequence diff --git a/test/sequence/std_array.cpp b/test/sequence/std_array.cpp index 902cbeca..50e09b39 100644 --- a/test/sequence/std_array.cpp +++ b/test/sequence/std_array.cpp @@ -33,6 +33,8 @@ int main() BOOST_MPL_ASSERT((traits::is_sequence)); BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(traits::is_sequence::value); + BOOST_STATIC_ASSERT(!traits::is_view::value); array_type arr = {{1,2,3}}; diff --git a/test/sequence/std_pair.cpp b/test/sequence/std_pair.cpp index 19f8e2a3..647e9b00 100644 --- a/test/sequence/std_pair.cpp +++ b/test/sequence/std_pair.cpp @@ -44,6 +44,7 @@ main() { typedef std::pair pair_type; BOOST_MPL_ASSERT_NOT((traits::is_view)); + BOOST_STATIC_ASSERT(!traits::is_view::value); pair_type p(123, "Hola!!!"); std::cout << at_c<0>(p) << std::endl; diff --git a/test/support/is_view.cpp b/test/support/is_view.cpp new file mode 100644 index 00000000..068f1a80 --- /dev/null +++ b/test/support/is_view.cpp @@ -0,0 +1,15 @@ +/*============================================================================= + Copyright (c) 2018 Nikita Kniazev + + 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 + + +// Make sure fusion::is_view can be used with non fusion types. +struct incomplete; +BOOST_STATIC_ASSERT(!boost::fusion::traits::is_view::value); + +int main() { }