From de61a00d62bebf30f484e3e60392e369a00780f9 Mon Sep 17 00:00:00 2001 From: djowel Date: Sun, 26 Sep 2021 09:00:43 +0800 Subject: [PATCH 01/28] Fix doc as per https://github.com/boostorg/fusion/issues/234 --- doc/container.qbk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/container.qbk b/doc/container.qbk index fccd2102..618ceab9 100644 --- a/doc/container.qbk +++ b/doc/container.qbk @@ -1016,8 +1016,8 @@ __note_ref_wrappers__, __fusion_pair__ [section Tiers] -Tiers are sequences, where all elements are non-const reference types. They -are constructed with a call to a couple of /tie/ function templates. The +Tiers are sequences, where all elements are reference types. They are +constructed with a call to a couple of /tie/ function templates. The succeeding sections document the various /tier/ flavors. * __list_tie__ @@ -2005,7 +2005,7 @@ __fusion_pair__s. There may be no duplicate __fusion_pair__ key types. as_map(__make_vector__( __fusion_make_pair__('X') , __fusion_make_pair__("Men"))) - + // from associative sequence namespace ns { @@ -2222,7 +2222,7 @@ __fusion_pair__s. There may be no duplicate __fusion_pair__ key types. result_of::as_map<__vector__< __fusion_pair__ , __fusion_pair__ > >::type - + // from associative sequence namespace ns { From c199f5c6fa7b5a6622a820ca53c5ec0c8c1b3ccb Mon Sep 17 00:00:00 2001 From: Denis Mikhailov Date: Sun, 31 Oct 2021 13:22:35 +0400 Subject: [PATCH 02/28] Update sequence.qbk --- doc/sequence.qbk | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/doc/sequence.qbk b/doc/sequence.qbk index 4625f8a5..dbd1456b 100644 --- a/doc/sequence.qbk +++ b/doc/sequence.qbk @@ -166,7 +166,7 @@ Bidirectional Sequence the following must be met: [[`__back__(s)`] [Any type] [] [Constant]] [[`__back__(s) = o`] [Any type] [`s` is mutable and `e = o`, where `e` - is the first element + is the last element in the sequence, is a valid expression.] [Constant]] ] @@ -237,14 +237,14 @@ any Random Access Sequence the following must be met: [[`__at_c__(s)`] [Any type] [] [Constant]] [[`__at_c__(s) = o`] [Any type] [`s` is mutable and `e = o`, where `e` - is the first element - in the sequence, is + is the N-th element from the beginning + of the sequence, is a valid expression.] [Constant]] [[`__at__(s)`] [Any type] [] [Constant]] [[`__at__(s) = o`] [Any type] [`s` is mutable and `e = o`, where `e` - is the first element - in the sequence, is + is the M-th element from the beginning + of the sequence, is a valid expression.] [Constant]] ] @@ -321,8 +321,7 @@ For any Associative Sequence the following expressions must be valid: [[`__at_key__(s)`] [Any type] [] [Constant]] [[`__at_key__(s) = o`] [Any type] [`s` is mutable and `e = o`, where `e` - is the first element - in the sequence, is + is the element associated with K, is a valid expression.] [Constant]] ] From 25f12dedc8beb09ec653e13eb8f85e7d591eeaad Mon Sep 17 00:00:00 2001 From: Denis Mikhailov Date: Sun, 31 Oct 2021 13:32:28 +0400 Subject: [PATCH 03/28] Update sequence.qbk --- doc/sequence.qbk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/sequence.qbk b/doc/sequence.qbk index dbd1456b..6f50fe21 100644 --- a/doc/sequence.qbk +++ b/doc/sequence.qbk @@ -713,11 +713,11 @@ Returns the M-th element from the beginning of the sequence. [heading Synopsis] template - typename __result_of_at__::type + typename __result_of_at__::type at(Sequence& seq); template - typename __result_of_at__::type + typename __result_of_at__::type at(Sequence const& seq); [heading Parameters] From 12c5097cf73dd66325099317f8c561040f3844e5 Mon Sep 17 00:00:00 2001 From: Denis Mikhailov Date: Fri, 5 Nov 2021 14:13:09 +0400 Subject: [PATCH 04/28] Update appveyor.yml --- appveyor.yml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 13dc44a7..cc1d3dce 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,17 +10,8 @@ shallow_clone: true environment: matrix: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - TOOLSET: msvc-9.0 - CXXSTD: latest # fake - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - TOOLSET: msvc-10.0 - CXXSTD: latest # fake - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - TOOLSET: msvc-11.0 - CXXSTD: latest # fake - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - TOOLSET: msvc-12.0 - CXXSTD: latest # fake + TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0,msvc-12.0 + ADDRMD: 32 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 TOOLSET: msvc-14.0 CXXSTD: 14 From 10f44ff5a0355d5bfbbe30525db1c73d1a26373e Mon Sep 17 00:00:00 2001 From: Denis Mikhailov Date: Fri, 5 Nov 2021 14:51:22 +0400 Subject: [PATCH 05/28] Update appveyor.yml --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index cc1d3dce..53192e2e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -79,4 +79,5 @@ install: build: off test_script: - - b2 -j%NUMBER_OF_PROCESSORS% --hash libs/fusion/test toolset=%TOOLSET% cxxstd=%CXXSTD% + - if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD% + - b2 -j%NUMBER_OF_PROCESSORS% --hash libs/fusion/test toolset=%TOOLSET% cxxstd=%CXXSTD% %ADDRMD% From 8ea7f31294db256e93fa36739066be632f82cb5a Mon Sep 17 00:00:00 2001 From: Denis Mikhailov Date: Fri, 5 Nov 2021 15:39:10 +0400 Subject: [PATCH 06/28] Update appveyor.yml --- appveyor.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 53192e2e..debd336b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,8 +10,21 @@ shallow_clone: true environment: matrix: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0,msvc-12.0 + TOOLSET: msvc-9.0 ADDRMD: 32 + CXXSTD: latest # fake + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + TOOLSET: msvc-10.0 + ADDRMD: 32 + CXXSTD: latest # fake + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + TOOLSET: msvc-11.0 + ADDRMD: 32 + CXXSTD: latest # fake + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + TOOLSET: msvc-12.0 + ADDRMD: 32 + CXXSTD: latest # fake - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 TOOLSET: msvc-14.0 CXXSTD: 14 From 5db3ed8134d94ed528f5de557b875ac6a6885914 Mon Sep 17 00:00:00 2001 From: denzor200 Date: Sat, 6 Nov 2021 20:09:19 +0400 Subject: [PATCH 07/28] [transform_view_ext] Updated docs --- doc/iterator.qbk | 1 + doc/sequence.qbk | 1 + doc/view.qbk | 15 ++++++--------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/doc/iterator.qbk b/doc/iterator.qbk index ef33240a..51640450 100644 --- a/doc/iterator.qbk +++ b/doc/iterator.qbk @@ -254,6 +254,7 @@ expressions must be valid: * __iterator_range__ iterator (where adapted iterators are __associative_iterator__\ s) * __joint_view__ iterator (where adapted sequences are __associative_sequence__\ s and __forward_sequence__\ s) * __reverse_view__ iterator (where adapted sequence is an __associative_sequence__ and a __bidirectional_sequence__) +* __transform_view__ iterator (where adapted sequence is an __associative_sequence__ and a __forward_sequence__) [endsect] diff --git a/doc/sequence.qbk b/doc/sequence.qbk index 6f50fe21..b193b8e9 100644 --- a/doc/sequence.qbk +++ b/doc/sequence.qbk @@ -360,6 +360,7 @@ you can use `__result_of_value_at_key__`.] * __iterator_range__ (where adapted iterators are __associative_iterator__\ s) * __joint_view__ (where adapted sequences are __associative_sequence__\ s and __forward_sequence__\ s) * __reverse_view__ (where adapted sequence is an __associative_sequence__ and a __bidirectional_sequence__) +* __transform_view__ (where adapted sequence is an __associative_sequence__ and a __forward_sequence__) [endsect] diff --git a/doc/view.qbk b/doc/view.qbk index f39fb7fa..6caa33fc 100644 --- a/doc/view.qbk +++ b/doc/view.qbk @@ -328,9 +328,7 @@ defined in __forward_sequence__. The unary version of `transform_view` presents a view of its underlying sequence given a unary function object or function pointer. The binary version of `transform_view` presents a view of 2 underlying sequences, -given a binary function object or function pointer. The `transform_view` -inherits the traversal characteristics (see __traversal_concept__) of -its underlying sequence or sequences. +given a binary function object or function pointer. [heading Header] @@ -362,9 +360,10 @@ its underlying sequence or sequences. [heading Model of] -* __forward_sequence__, __bidirectional_sequence__ or -__random_access_sequence__ depending on the traversal characteristics (see -__traversal_concept__) of its underlying sequence. +* A model of __forward_sequence__ if `Sequence` is a __forward_sequence__ +else, __bidirectional_sequence__ if `Sequence` is a __bidirectional_sequence__ +else, __random_access_sequence__ if `Sequence` is a __random_access_sequence__. +* __associative_sequence__ if `Sequence` implements the __associative_sequence__ model. [variablelist Notation [[`TV`] [A `transform_view` type]] @@ -381,9 +380,7 @@ __traversal_concept__) of its underlying sequence. [heading Expression Semantics] Semantics of an expression is defined only where it differs from, or is not -defined in __forward_sequence__, __bidirectional_sequence__ or -__random_access_sequence__ depending on the traversal characteristics (see -__traversal_concept__) of its underlying sequence or sequences. +defined in the implemented models. [table [[Expression] [Semantics]] From f07cca743ff2f5d8294b68a8e2c36d6229c5499f Mon Sep 17 00:00:00 2001 From: Denis Mikhailov Date: Sun, 7 Nov 2021 03:03:18 +0400 Subject: [PATCH 08/28] Update reverse_view.cpp --- test/sequence/reverse_view.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/sequence/reverse_view.cpp b/test/sequence/reverse_view.cpp index fb96275d..4e6688f5 100644 --- a/test/sequence/reverse_view.cpp +++ b/test/sequence/reverse_view.cpp @@ -102,6 +102,21 @@ main() BOOST_TEST((at_c<2>(rev) == pair2("two"))); BOOST_TEST((at_c<3>(rev) == pair1("one"))); BOOST_TEST((at_c<4>(rev) == pair0("zero"))); + BOOST_TEST(( has_key< boost::mpl::int_<0> >(rev) + && has_key< boost::mpl::int_<4> >(rev) + && !has_key< boost::mpl::int_<-1> >(rev) + && !has_key< boost::mpl::int_<5> >(rev) )); + BOOST_TEST((at_key< boost::mpl::int_<0> >(rev) == "zero")); + BOOST_TEST((at_key< boost::mpl::int_<1> >(rev) == "one")); + BOOST_TEST((at_key< boost::mpl::int_<2> >(rev) == "two")); + BOOST_TEST((at_key< boost::mpl::int_<3> >(rev) == "three")); + BOOST_TEST((at_key< boost::mpl::int_<4> >(rev) == "four")); + BOOST_TEST(( (at_key< boost::mpl::int_<0> >(rev) = "new_zero") == "new_zero" + && at_key< boost::mpl::int_<0> >(rev) == "new_zero" )); + BOOST_MPL_ASSERT((boost::mpl::and_ > + , boost::mpl::not_ > > >)); + BOOST_MPL_ASSERT((boost::is_same>::type, std::string&>)); + BOOST_MPL_ASSERT((boost::is_same >::type, std::string>)); } return boost::report_errors(); From 380a2bc7a04e022e590d6b80f4db3c8dd6a2c401 Mon Sep 17 00:00:00 2001 From: Denis Mikhailov Date: Sun, 7 Nov 2021 03:29:06 +0400 Subject: [PATCH 09/28] Update reverse_view.cpp --- test/sequence/reverse_view.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/sequence/reverse_view.cpp b/test/sequence/reverse_view.cpp index 4e6688f5..2b587a21 100644 --- a/test/sequence/reverse_view.cpp +++ b/test/sequence/reverse_view.cpp @@ -15,6 +15,9 @@ #include #include #include +#include +#include +#include #include #include #include From 95cf8bdb8dba61a9eda579a66acec40c0c885577 Mon Sep 17 00:00:00 2001 From: denzor200 Date: Sun, 7 Nov 2021 23:07:18 +0400 Subject: [PATCH 10/28] Applied fixes for reverse_view --- .../reverse_view/detail/deref_data_impl.hpp | 21 ++++--------------- .../view/reverse_view/detail/key_of_impl.hpp | 13 ++++++++++-- .../detail/value_of_data_impl.hpp | 4 +++- test/sequence/reverse_view.cpp | 1 + 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/include/boost/fusion/view/reverse_view/detail/deref_data_impl.hpp b/include/boost/fusion/view/reverse_view/detail/deref_data_impl.hpp index e93b8fba..dc995dde 100644 --- a/include/boost/fusion/view/reverse_view/detail/deref_data_impl.hpp +++ b/include/boost/fusion/view/reverse_view/detail/deref_data_impl.hpp @@ -1,5 +1,6 @@ /*============================================================================= Copyright (c) 2009 Christopher Schmidt + Copyright (c) 2021 Denis Mikhailov 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) @@ -9,7 +10,7 @@ #define BOOST_FUSION_VIEW_REVERSE_VIEW_DETAIL_DEREF_DATA_IMPL_HPP #include -#include +#include namespace boost { namespace fusion { namespace extension { @@ -18,22 +19,8 @@ namespace boost { namespace fusion { namespace extension template <> struct deref_data_impl - { - template - struct apply - { - typedef typename - result_of::deref_data::type - type; - - BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED - static type - call(It const& it) - { - return fusion::deref_data(it.first); - } - }; - }; + : deref_impl + {}; }}} #endif diff --git a/include/boost/fusion/view/reverse_view/detail/key_of_impl.hpp b/include/boost/fusion/view/reverse_view/detail/key_of_impl.hpp index 985e5fa9..a2d8daef 100644 --- a/include/boost/fusion/view/reverse_view/detail/key_of_impl.hpp +++ b/include/boost/fusion/view/reverse_view/detail/key_of_impl.hpp @@ -1,5 +1,6 @@ /*============================================================================= Copyright (c) 2009 Christopher Schmidt + Copyright (c) 2021 Denis Mikhailov 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) @@ -10,6 +11,7 @@ #include #include +#include namespace boost { namespace fusion { namespace extension { @@ -21,8 +23,15 @@ namespace boost { namespace fusion { namespace extension { template struct apply - : result_of::key_of - {}; + { + typedef typename + result_of::key_of< + typename result_of::prior< + typename It::first_type + >::type + >::type + type; + }; }; }}} diff --git a/include/boost/fusion/view/reverse_view/detail/value_of_data_impl.hpp b/include/boost/fusion/view/reverse_view/detail/value_of_data_impl.hpp index a96d1ce3..d4b728de 100644 --- a/include/boost/fusion/view/reverse_view/detail/value_of_data_impl.hpp +++ b/include/boost/fusion/view/reverse_view/detail/value_of_data_impl.hpp @@ -1,5 +1,6 @@ /*============================================================================= Copyright (c) 2009 Christopher Schmidt + Copyright (c) 2021 Denis Mikhailov 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) @@ -10,6 +11,7 @@ #include #include +#include namespace boost { namespace fusion { namespace extension { @@ -21,7 +23,7 @@ namespace boost { namespace fusion { namespace extension { template struct apply - : result_of::value_of_data + : value_of_impl {}; }; }}} diff --git a/test/sequence/reverse_view.cpp b/test/sequence/reverse_view.cpp index 2b587a21..b6afac99 100644 --- a/test/sequence/reverse_view.cpp +++ b/test/sequence/reverse_view.cpp @@ -1,5 +1,6 @@ /*============================================================================= Copyright (c) 2001-2011 Joel de Guzman + Copyright (c) 2021 Denis Mikhailov 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) From 2bb8a26c5b951ef6186a96cedf4341314b5c6a86 Mon Sep 17 00:00:00 2001 From: denzor200 Date: Mon, 8 Nov 2021 02:11:31 +0400 Subject: [PATCH 11/28] Fixed all '*_data' methods in reverse_view --- .../reverse_view/detail/deref_data_impl.hpp | 25 ++++++++++++++++--- .../detail/value_of_data_impl.hpp | 15 ++++++++--- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/include/boost/fusion/view/reverse_view/detail/deref_data_impl.hpp b/include/boost/fusion/view/reverse_view/detail/deref_data_impl.hpp index dc995dde..e9bb9a02 100644 --- a/include/boost/fusion/view/reverse_view/detail/deref_data_impl.hpp +++ b/include/boost/fusion/view/reverse_view/detail/deref_data_impl.hpp @@ -10,7 +10,8 @@ #define BOOST_FUSION_VIEW_REVERSE_VIEW_DETAIL_DEREF_DATA_IMPL_HPP #include -#include +#include +#include namespace boost { namespace fusion { namespace extension { @@ -19,8 +20,26 @@ namespace boost { namespace fusion { namespace extension template <> struct deref_data_impl - : deref_impl - {}; + { + template + struct apply + { + typedef typename + result_of::deref_data< + typename result_of::prior< + typename Iterator::first_type + >::type + >::type + type; + + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static type + call(Iterator const& i) + { + return fusion::deref_data(fusion::prior(i.first)); + } + }; + }; }}} #endif diff --git a/include/boost/fusion/view/reverse_view/detail/value_of_data_impl.hpp b/include/boost/fusion/view/reverse_view/detail/value_of_data_impl.hpp index d4b728de..c657f9e0 100644 --- a/include/boost/fusion/view/reverse_view/detail/value_of_data_impl.hpp +++ b/include/boost/fusion/view/reverse_view/detail/value_of_data_impl.hpp @@ -11,7 +11,7 @@ #include #include -#include +#include namespace boost { namespace fusion { namespace extension { @@ -21,10 +21,17 @@ namespace boost { namespace fusion { namespace extension template <> struct value_of_data_impl { - template + template struct apply - : value_of_impl - {}; + { + typedef typename + result_of::value_of_data< + typename result_of::prior< + typename Iterator::first_type + >::type + >::type + type; + }; }; }}} From aa5ea2af6981dc3b09c303443e3ab0a4be90b69c Mon Sep 17 00:00:00 2001 From: Denis Mikhailov Date: Sun, 9 Jan 2022 07:45:54 +0400 Subject: [PATCH 12/28] Update view.qbk --- doc/view.qbk | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/doc/view.qbk b/doc/view.qbk index f39fb7fa..e65ac630 100644 --- a/doc/view.qbk +++ b/doc/view.qbk @@ -328,9 +328,7 @@ defined in __forward_sequence__. The unary version of `transform_view` presents a view of its underlying sequence given a unary function object or function pointer. The binary version of `transform_view` presents a view of 2 underlying sequences, -given a binary function object or function pointer. The `transform_view` -inherits the traversal characteristics (see __traversal_concept__) of -its underlying sequence or sequences. +given a binary function object or function pointer. [heading Header] @@ -364,7 +362,7 @@ its underlying sequence or sequences. * __forward_sequence__, __bidirectional_sequence__ or __random_access_sequence__ depending on the traversal characteristics (see -__traversal_concept__) of its underlying sequence. +__traversal_concept__) of its underlying sequence or sequences. [variablelist Notation [[`TV`] [A `transform_view` type]] @@ -381,9 +379,7 @@ __traversal_concept__) of its underlying sequence. [heading Expression Semantics] Semantics of an expression is defined only where it differs from, or is not -defined in __forward_sequence__, __bidirectional_sequence__ or -__random_access_sequence__ depending on the traversal characteristics (see -__traversal_concept__) of its underlying sequence or sequences. +defined in the implemented models. [table [[Expression] [Semantics]] From a57683a68d24cbaab9df5f2edc6c77d63f6587a3 Mon Sep 17 00:00:00 2001 From: denzor200 Date: Sun, 9 Jan 2022 16:34:07 +0400 Subject: [PATCH 13/28] [transform_view_ext] Unary transform_view is an Associative Sequence now --- doc/view.qbk | 1 + .../transform_view/detail/deref_data_impl.hpp | 66 +++++ .../transform_view/detail/key_of_impl.hpp | 47 +++ .../detail/value_of_data_impl.hpp | 47 +++ .../transform_view_iterator.hpp | 3 + test/sequence/transform_view.cpp | 273 ++++++++++++++++++ 6 files changed, 437 insertions(+) create mode 100644 include/boost/fusion/view/transform_view/detail/deref_data_impl.hpp create mode 100644 include/boost/fusion/view/transform_view/detail/key_of_impl.hpp create mode 100644 include/boost/fusion/view/transform_view/detail/value_of_data_impl.hpp diff --git a/doc/view.qbk b/doc/view.qbk index e65ac630..d99b325f 100644 --- a/doc/view.qbk +++ b/doc/view.qbk @@ -363,6 +363,7 @@ given a binary function object or function pointer. * __forward_sequence__, __bidirectional_sequence__ or __random_access_sequence__ depending on the traversal characteristics (see __traversal_concept__) of its underlying sequence or sequences. +* __associative_sequence__ if underlying sequence implements the __associative_sequence__ model(available only with unary version of `transform_view`). [variablelist Notation [[`TV`] [A `transform_view` type]] diff --git a/include/boost/fusion/view/transform_view/detail/deref_data_impl.hpp b/include/boost/fusion/view/transform_view/detail/deref_data_impl.hpp new file mode 100644 index 00000000..3eb325a4 --- /dev/null +++ b/include/boost/fusion/view/transform_view/detail/deref_data_impl.hpp @@ -0,0 +1,66 @@ +/*============================================================================= + Copyright (c) 2022 Denis Mikhailov + 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) +==============================================================================*/ + +#if !defined(BOOST_FUSION_TRANSFORM_VIEW_DEREF_DATA_IMPL_JAN_9_2022_0354PM) +#define BOOST_FUSION_TRANSFORM_VIEW_DEREF_DATA_IMPL_JAN_9_2022_0354PM + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct transform_view_iterator_tag; + struct transform_view_iterator2_tag; + + namespace extension + { + template + struct deref_data_impl; + + // Unary Version + template<> + struct deref_data_impl + { + template + struct apply + { + typedef typename + result_of::deref::type + value_type; + + typedef typename Iterator::transform_type F; + typedef typename boost::result_of::type transformed_type; + typedef typename boost::remove_reference::type transformed_type_unref; + typedef typename boost::remove_const::type transformed_type_unconst; + + typedef typename transformed_type_unconst::second_type raw_type; + typedef typename + boost::mpl::if_< + is_reference + , typename boost::mpl::if_< + is_const + , typename boost::add_reference::type>::type + , typename boost::add_reference::type + >::type + , raw_type + >::type + type; + + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static type + call(Iterator const& i) + { + return i.f(fusion::deref(i.first)).second; + } + }; + }; + + // Binary Version is not supported with Associative Sequence + } +}} + +#endif diff --git a/include/boost/fusion/view/transform_view/detail/key_of_impl.hpp b/include/boost/fusion/view/transform_view/detail/key_of_impl.hpp new file mode 100644 index 00000000..226814f1 --- /dev/null +++ b/include/boost/fusion/view/transform_view/detail/key_of_impl.hpp @@ -0,0 +1,47 @@ +/*============================================================================= + Copyright (c) 2022 Denis Mikhailov + 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) +==============================================================================*/ + +#if !defined(BOOST_FUSION_TRANSFORM_VIEW_KEY_OF_IMPL_JAN_9_2022_0354PM) +#define BOOST_FUSION_TRANSFORM_VIEW_KEY_OF_IMPL_JAN_9_2022_0354PM + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct transform_view_iterator_tag; + struct transform_view_iterator2_tag; + + namespace extension + { + template + struct key_of_impl; + + // Unary Version + template<> + struct key_of_impl + { + template + struct apply + { + typedef typename + result_of::deref::type + value_type; + + typedef typename Iterator::transform_type F; + typedef typename boost::result_of::type transformed_type; + typedef typename boost::remove_reference::type transformed_type_unref; + typedef typename boost::remove_const::type transformed_type_unconst; + + typedef typename transformed_type_unconst::first_type type; + }; + }; + + // Binary Version is not supported with Associative Sequence + } +}} +#endif diff --git a/include/boost/fusion/view/transform_view/detail/value_of_data_impl.hpp b/include/boost/fusion/view/transform_view/detail/value_of_data_impl.hpp new file mode 100644 index 00000000..e350db49 --- /dev/null +++ b/include/boost/fusion/view/transform_view/detail/value_of_data_impl.hpp @@ -0,0 +1,47 @@ +/*============================================================================= + Copyright (c) 2022 Denis Mikhailov + 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) +==============================================================================*/ + +#if !defined(BOOST_FUSION_TRANSFORM_VIEW_VALUE_OF_IMPL_JAN_9_2022_0354PM) +#define BOOST_FUSION_TRANSFORM_VIEW_VALUE_OF_IMPL_JAN_9_2022_0354PM + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct transform_view_iterator_tag; + struct transform_view_iterator2_tag; + + namespace extension + { + template + struct value_of_data_impl; + + // Unary Version + template<> + struct value_of_data_impl + { + template + struct apply + { + typedef typename + result_of::deref::type + value_type; + + typedef typename Iterator::transform_type F; + typedef typename boost::result_of::type transformed_type; + typedef typename boost::remove_reference::type transformed_type_unref; + typedef typename boost::remove_const::type transformed_type_unconst; + + typedef typename transformed_type_unconst::second_type type; + }; + }; + + // Binary Version is not supported with Associative Sequence + } +}} +#endif diff --git a/include/boost/fusion/view/transform_view/transform_view_iterator.hpp b/include/boost/fusion/view/transform_view/transform_view_iterator.hpp index 2689ae8a..071cba8e 100644 --- a/include/boost/fusion/view/transform_view/transform_view_iterator.hpp +++ b/include/boost/fusion/view/transform_view/transform_view_iterator.hpp @@ -19,6 +19,9 @@ #include #include #include +#include +#include +#include namespace boost { namespace fusion { diff --git a/test/sequence/transform_view.cpp b/test/sequence/transform_view.cpp index b9e3f943..4f11e6b7 100644 --- a/test/sequence/transform_view.cpp +++ b/test/sequence/transform_view.cpp @@ -1,11 +1,14 @@ /*============================================================================= Copyright (c) 2001-2011 Joel de Guzman + Copyright (c) 2022 Denis Mikhailov 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 @@ -14,15 +17,29 @@ #include #include #include +#include +#include +#include +#include #include #include #include #include #include +#include +#include +#include +#include +#include #include #include +#include +#include #include +#include +#include +#include struct square { @@ -60,6 +77,85 @@ struct add } }; +struct abstract +{ + virtual void foo() = 0; +}; + +struct functor +{ + typedef boost::fusion::pair pair_0; + typedef boost::fusion::pair pair_1; + typedef boost::fusion::pair pair_2; + + typedef boost::mpl::map< + boost::mpl::pair< boost::fusion::pair , pair_0> + , boost::mpl::pair< pair_1 , pair_1> + , boost::mpl::pair< boost::fusion::pair , pair_2> + > m; + + template + struct result; + + template + struct result + : boost::mpl::at< + m, + typename boost::remove_reference::type + > + {}; + + pair_0 operator() (const boost::fusion::pair& arg) const + { + return pair_0(arg.second); + } + + pair_1 operator() (const pair_1 & arg) const + { + return pair_1(arg.second + "_transformed"); + } + + pair_2 operator() (const boost::fusion::pair& arg) const + { + return pair_2(arg.second); + } +}; + +struct simple_identity +{ + template + struct result; + + template + struct result + { + typedef U type; + }; + + template + T& operator() (T& arg) const + { + return arg; + } +}; + +struct simple_identity_nonref +{ + template + struct result; + + template + struct result + : boost::remove_reference + {}; + + template + T operator() (T arg) const + { + return arg; + } +}; + int main() { @@ -110,6 +206,183 @@ main() BOOST_MPL_ASSERT((boost::is_same::type, int>)); } + /// Associative + { + typedef map< + pair + , pair + , pair > + map_type; + typedef transform_view transformed_type; + + BOOST_MPL_ASSERT((traits::is_associative)); + BOOST_MPL_ASSERT((traits::is_random_access)); + + map_type m( + make_pair('X') + , make_pair("Men") + , make_pair(2)); + transformed_type t(m, functor()); + + std::cout << at_key(t) << std::endl; + std::cout << at_key(t) << std::endl; + std::cout << at_key(t) << std::endl; + + BOOST_TEST(at_key(t) == 'X'); + BOOST_TEST(at_key(t) == "Men_transformed"); + BOOST_TEST(at_key(t) == 2); + + BOOST_STATIC_ASSERT(( + boost::is_same::type, char>::value)); + BOOST_STATIC_ASSERT(( + boost::is_same::type, std::string>::value)); + BOOST_STATIC_ASSERT(( + boost::is_same::type, long>::value)); + + std::cout << t << std::endl; + + BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key::value)); + BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key::value)); + BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key::value)); + BOOST_STATIC_ASSERT((!boost::fusion::result_of::has_key::value)); + + std::cout << deref_data(begin(t)) << std::endl; + std::cout << deref_data(boost::fusion::next(begin(t))) << std::endl; + + BOOST_TEST(deref_data(begin(t)) == 'X'); + BOOST_TEST(deref_data(boost::fusion::next(begin(t))) == "Men_transformed"); + BOOST_TEST(deref_data(boost::fusion::next(next(begin(t)))) == 2); + + BOOST_STATIC_ASSERT((boost::is_same::type>::type, short>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type, double>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type>::type, abstract>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type, char>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type, std::string>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type>::type, long>::value)); + + // Test random access interface. + pair a = at_c<0>(t); (void) a; + pair b = at_c<1>(t); + pair c = at_c<2>(t); + (void)c; + + typedef boost::fusion::result_of::begin::type first; + typedef boost::fusion::result_of::next::type second; + typedef boost::fusion::result_of::next::type third; + + BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair >)); + BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair >)); + BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair >)); + } + + { + typedef map< + pair + , pair + , pair > + map_type; + typedef transform_view transformed_type; + + BOOST_MPL_ASSERT((traits::is_associative)); + BOOST_MPL_ASSERT((traits::is_random_access)); + + map_type m( + make_pair('X') + , make_pair("Men") + , make_pair(2)); + transformed_type t(m, simple_identity()); + + std::cout << at_key(t) << std::endl; + std::cout << at_key(t) << std::endl; + std::cout << at_key(t) << std::endl; + + BOOST_TEST(at_key(t) == 'X'); + BOOST_TEST(at_key(t) == "Men"); + BOOST_TEST(at_key(t) == 2); + + BOOST_STATIC_ASSERT(( + boost::is_same::type, char>::value)); + BOOST_STATIC_ASSERT(( + boost::is_same::type, std::string>::value)); + BOOST_STATIC_ASSERT(( + boost::is_same::type, int>::value)); + + std::cout << t << std::endl; + + BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key::value)); + BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key::value)); + BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key::value)); + BOOST_STATIC_ASSERT((!boost::fusion::result_of::has_key::value)); + + std::cout << deref_data(begin(t)) << std::endl; + std::cout << deref_data(boost::fusion::next(begin(t))) << std::endl; + + BOOST_TEST(deref_data(begin(t)) == 'X'); + BOOST_TEST(deref_data(boost::fusion::next(begin(t))) == "Men"); + BOOST_TEST(deref_data(boost::fusion::next(next(begin(t)))) == 2); + + BOOST_STATIC_ASSERT((boost::is_same::type>::type, int>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type, double>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type>::type, abstract>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type, char>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type, std::string>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type>::type, int>::value)); + + // Test random access interface. + pair a = at_c<0>(t); (void) a; + pair b = at_c<1>(t); + pair c = at_c<2>(t); + (void)c; + + typedef boost::fusion::result_of::begin::type first; + typedef boost::fusion::result_of::next::type second; + typedef boost::fusion::result_of::next::type third; + + // BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair >)); + // BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair >)); + // BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair >)); + } + + { + // compile test only + // make sure result_of::deref_data returns a reference + typedef map > map_type; + typedef transform_view transformed_type; + typedef boost::fusion::result_of::begin::type i_type; + typedef boost::fusion::result_of::deref_data::type r_type; + BOOST_STATIC_ASSERT((boost::is_same::value)); + } + + { + // compile test only + // make sure result_of::deref_data is const correct + typedef map > const map_type; + typedef transform_view transformed_type; + typedef boost::fusion::result_of::begin::type i_type; + typedef boost::fusion::result_of::deref_data::type r_type; + BOOST_STATIC_ASSERT((boost::is_same::value)); + } + + { + // compile test only + // make sure result_of::deref_data will not return a reference to temp object + typedef map > const map_type; + typedef transform_view transformed_type; + typedef boost::fusion::result_of::begin::type i_type; + typedef boost::fusion::result_of::deref_data::type r_type; + BOOST_STATIC_ASSERT((boost::is_same::value)); + } + + { + // compile test only + // make sure result_of::deref_data will not const for non-constant references + typedef map > const map_type; + typedef transform_view transformed_type; + typedef boost::fusion::result_of::begin::type i_type; + typedef boost::fusion::result_of::deref_data::type r_type; + BOOST_STATIC_ASSERT((boost::is_same::value)); + } + return boost::report_errors(); } From eed79cb557b2980992e2d13213b8258dbcde19da Mon Sep 17 00:00:00 2001 From: denzor200 Date: Mon, 10 Jan 2022 21:19:38 +0400 Subject: [PATCH 14/28] [identity_view] Added boost::fusion::identity_view --- doc/fusion.qbk | 1 + doc/html/index.html | 1 + doc/organization.qbk | 1 + doc/sequence.qbk | 4 + doc/view.qbk | 57 ++++++ .../boost/fusion/include/identity_view.hpp | 12 ++ include/boost/fusion/view.hpp | 1 + include/boost/fusion/view/identity_view.hpp | 14 ++ .../view/identity_view/identity_view.hpp | 27 +++ test/Jamfile | 1 + test/sequence/identity_view.cpp | 184 ++++++++++++++++++ 11 files changed, 303 insertions(+) create mode 100644 include/boost/fusion/include/identity_view.hpp create mode 100644 include/boost/fusion/view/identity_view.hpp create mode 100644 include/boost/fusion/view/identity_view/identity_view.hpp create mode 100644 test/sequence/identity_view.cpp diff --git a/doc/fusion.qbk b/doc/fusion.qbk index 6d6987d5..f7a5bf76 100644 --- a/doc/fusion.qbk +++ b/doc/fusion.qbk @@ -130,6 +130,7 @@ [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 __identity_view__ [link fusion.view.identity_view `identity_view`]] [def __array__ [link fusion.adapted.array array]] [def __std_pair__ [link fusion.adapted.std__pair `std::pair`]] diff --git a/doc/html/index.html b/doc/html/index.html index 957609a9..9f0f14da 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -163,6 +163,7 @@
zip_view
transform_view
reverse_view
+
identity_view
nview
repetitive_view
flatten_view
diff --git a/doc/organization.qbk b/doc/organization.qbk index b7166f5d..b062e6ed 100644 --- a/doc/organization.qbk +++ b/doc/organization.qbk @@ -60,6 +60,7 @@ link against. * single_view * transform_view * zip_view + * identity_view * container * deque * list diff --git a/doc/sequence.qbk b/doc/sequence.qbk index b193b8e9..554d951f 100644 --- a/doc/sequence.qbk +++ b/doc/sequence.qbk @@ -133,6 +133,7 @@ For any Forward Sequence s the following invariants always hold: * __transform_view__ * __reverse_view__ * __zip_view__ +* __identity_view__ [endsect] @@ -201,6 +202,7 @@ are not defined in __forward_sequence__. * __iterator_range__ (where adapted sequence is a Bidirectional Sequence) * __transform_view__ (where adapted sequence is a Bidirectional Sequence) * __zip_view__ (where adapted sequences are models of Bidirectional Sequence) +* __identity_view__ (where adapted sequence is a Bidirectional Sequence) [endsect] @@ -289,6 +291,7 @@ are not defined in __bidirectional_sequence__. * __iterator_range__ (where adapted sequence is a Random Access Sequence) * __transform_view__ (where adapted sequence is a Random Access Sequence) * __zip_view__ (where adapted sequences are models of Random Access Sequence) +* __identity_view__ (where adapted sequence is a Random Access Sequence) [endsect] @@ -361,6 +364,7 @@ you can use `__result_of_value_at_key__`.] * __joint_view__ (where adapted sequences are __associative_sequence__\ s and __forward_sequence__\ s) * __reverse_view__ (where adapted sequence is an __associative_sequence__ and a __bidirectional_sequence__) * __transform_view__ (where adapted sequence is an __associative_sequence__ and a __forward_sequence__) +* __identity_view__ (where adapted sequence is an __associative_sequence__ and a __forward_sequence__) [endsect] diff --git a/doc/view.qbk b/doc/view.qbk index d99b325f..a3ad4d09 100644 --- a/doc/view.qbk +++ b/doc/view.qbk @@ -1,6 +1,7 @@ [/============================================================================== Copyright (C) 2001-2011 Joel de Guzman Copyright (C) 2006 Dan Marsden + Copyright (c) 2022 Denis Mikhailov Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -664,4 +665,60 @@ defined in __forward_sequence__. [endsect] +[section identity_view] + +[heading Description] + +`identity_view` presents underlying sequence unchanged. + +[heading Header] + + #include + #include + +[heading Synopsis] + + template + struct identity_view; + +[heading Template parameters] + +[table + [[Parameter] [Description] [Default]] + [[`Sequence`] [A __forward_sequence__] []] +] + +[heading Model of] + +* A model of __forward_sequence__ if `Sequence` is a __forward_sequence__ else, __bidirectional_sequence__ if `Sequence` is a __bidirectional_sequence__ +else, __random_access_sequence__ if `Sequence` is a __random_access_sequence__. +* __associative_sequence__ if `Sequence` implements the __associative_sequence__ model. + +[variablelist Notation + [[`IV`] [An `identity_view` type]] + [[`s`] [An instance of `Sequence`]] + [[`iv`, `iv2`] [Instances of `identity_view`]] +] + +[heading Expression Semantics] + +Semantics of an expression is defined only where it differs from, or is not +defined in the implemented models. + +[table + [[Expression] [Semantics]] + [[`IV(s)`] [Creates an `identity_view` given sequence, `s`.]] + [[`IV(iv)`] [Copy constructs an `identity_view` from another `identity_view`, `iv`.]] + [[`iv = iv2`] [Assigns to an `identity_view`, `iv`, from another `identity_view`, `iv2`.]] +] + +[heading Example] + typedef __vector__ vector_type; + vector_type vec(2, 5, 3.3); + + __identity_view__ identity(vec); + std::cout << identity << std::endl; // (2 5 3.3) + +[endsect] + [endsect] diff --git a/include/boost/fusion/include/identity_view.hpp b/include/boost/fusion/include/identity_view.hpp new file mode 100644 index 00000000..bb27d27b --- /dev/null +++ b/include/boost/fusion/include/identity_view.hpp @@ -0,0 +1,12 @@ +/*============================================================================= + Copyright (c) 2022 Denis Mikhailov + 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) +==============================================================================*/ +#if !defined(FUSION_INCLUDE_IDENTITY_VIEW) +#define FUSION_INCLUDE_IDENTITY_VIEW + +#include +#include + +#endif \ No newline at end of file diff --git a/include/boost/fusion/view.hpp b/include/boost/fusion/view.hpp index 4cb49122..0d8ded42 100644 --- a/include/boost/fusion/view.hpp +++ b/include/boost/fusion/view.hpp @@ -17,5 +17,6 @@ #include #include #include +#include #endif diff --git a/include/boost/fusion/view/identity_view.hpp b/include/boost/fusion/view/identity_view.hpp new file mode 100644 index 00000000..72414cbe --- /dev/null +++ b/include/boost/fusion/view/identity_view.hpp @@ -0,0 +1,14 @@ +/*============================================================================= + Copyright (c) 2022 Denis Mikhailov + 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) +==============================================================================*/ + +#if !defined(BOOST_FUSION_SEQUENCE_IDENTITY_VIEW_HPP_INCLUDED) +#define BOOST_FUSION_SEQUENCE_IDENTITY_VIEW_HPP_INCLUDED + +#include +#include + + +#endif \ No newline at end of file diff --git a/include/boost/fusion/view/identity_view/identity_view.hpp b/include/boost/fusion/view/identity_view/identity_view.hpp new file mode 100644 index 00000000..f26f2bc7 --- /dev/null +++ b/include/boost/fusion/view/identity_view/identity_view.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2022 Denis Mikhailov + 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) +==============================================================================*/ + +#if !defined(BOOST_FUSION_IDENTITY_VIEW_HPP_INCLUDED) +#define BOOST_FUSION_IDENTITY_VIEW_HPP_INCLUDED + +#include +#include +#include + +namespace boost { namespace fusion { + template struct identity_view + : transform_view + { + typedef transform_view base_type; + + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + identity_view(Sequence& in_seq) + : base_type(in_seq, boost::identity()) {} + }; + +}} + +#endif diff --git a/test/Jamfile b/test/Jamfile index e55b15ad..13dd35c5 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -156,6 +156,7 @@ project : BOOST_FUSION_DISABLE_VARIADIC_VECTOR : tuple_traits__no_variadic ] [ run sequence/transform_view.cpp ] + [ run sequence/identity_view.cpp ] [ run sequence/vector_comparison.cpp ] [ run sequence/vector_construction.cpp ] [ run sequence/vector_conversion.cpp ] diff --git a/test/sequence/identity_view.cpp b/test/sequence/identity_view.cpp new file mode 100644 index 00000000..285b17e2 --- /dev/null +++ b/test/sequence/identity_view.cpp @@ -0,0 +1,184 @@ +/*============================================================================= + Copyright (c) 2022 Denis Mikhailov + + 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +struct abstract +{ + virtual void foo() = 0; +}; + +int +main() +{ + using namespace boost::fusion; + + std::cout << tuple_open('['); + std::cout << tuple_close(']'); + std::cout << tuple_delimiter(", "); + +/// Testing the identity_view + + { + typedef boost::mpl::range_c sequence_type; + sequence_type sequence; + typedef identity_view xform_type; + xform_type xform(sequence); + + std::cout << xform << std::endl; + BOOST_TEST((xform == make_vector(5, 6, 7, 8))); + + typedef boost::fusion::result_of::begin::type first_type; + first_type first_it(boost::fusion::begin(xform)); + + typedef boost::fusion::result_of::next::type next_type; + next_type next_it(boost::fusion::next(first_it)); + BOOST_TEST((*next_it == 6)); + BOOST_TEST((*boost::fusion::prior(next_it) == 5)); + BOOST_TEST((boost::fusion::distance(first_it, next_it) == 1)); + + BOOST_TEST((*boost::fusion::advance_c<3>(boost::fusion::begin(xform)) == 8)); + BOOST_TEST((boost::fusion::at_c<2>(xform) == 7)); + BOOST_MPL_ASSERT((boost::is_same::type, boost::mpl::integral_c&& >)); + } + + /// Associative + { + typedef map< + pair + , pair + , pair > + map_type; + typedef identity_view transformed_type; + + BOOST_MPL_ASSERT((traits::is_associative)); + BOOST_MPL_ASSERT((traits::is_random_access)); + + map_type m( + make_pair('X') + , make_pair("Men") + , make_pair(2)); + transformed_type t(m); + + std::cout << at_key(t) << std::endl; + std::cout << at_key(t) << std::endl; + std::cout << at_key(t) << std::endl; + + BOOST_TEST(at_key(t) == 'X'); + BOOST_TEST(at_key(t) == "Men"); + BOOST_TEST(at_key(t) == 2); + + BOOST_STATIC_ASSERT(( + boost::is_same::type, char>::value)); + BOOST_STATIC_ASSERT(( + boost::is_same::type, std::string>::value)); + BOOST_STATIC_ASSERT(( + boost::is_same::type, int>::value)); + + std::cout << t << std::endl; + + BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key::value)); + BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key::value)); + BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key::value)); + BOOST_STATIC_ASSERT((!boost::fusion::result_of::has_key::value)); + + std::cout << deref_data(begin(t)) << std::endl; + std::cout << deref_data(boost::fusion::next(begin(t))) << std::endl; + + BOOST_TEST(deref_data(begin(t)) == 'X'); + BOOST_TEST(deref_data(boost::fusion::next(begin(t))) == "Men"); + BOOST_TEST(deref_data(boost::fusion::next(next(begin(t)))) == 2); + + BOOST_STATIC_ASSERT((boost::is_same::type>::type, int>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type, double>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type>::type, abstract>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type, char>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type, std::string>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type>::type, int>::value)); + + // Test random access interface. + pair a = at_c<0>(t); (void) a; + pair b = at_c<1>(t); + pair c = at_c<2>(t); + (void)c; + + typedef boost::fusion::result_of::begin::type first; + typedef boost::fusion::result_of::next::type second; + typedef boost::fusion::result_of::next::type third; + + // TODO: why is a boost::fusion::pair&& ?? + BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair&& >)); + BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair&& >)); + BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair&& >)); + } + + { + // compile test only + // make sure result_of::deref_data returns a reference + typedef map > map_type; + typedef identity_view transformed_type; + typedef boost::fusion::result_of::begin::type i_type; + typedef boost::fusion::result_of::deref_data::type r_type; + BOOST_STATIC_ASSERT((boost::is_same::value)); + } + + { + // compile test only + // make sure result_of::deref_data is const correct + typedef map > const map_type; + typedef identity_view transformed_type; + typedef boost::fusion::result_of::begin::type i_type; + typedef boost::fusion::result_of::deref_data::type r_type; + BOOST_STATIC_ASSERT((boost::is_same::value)); + } + + { + // compile test only + // make sure result_of::deref_data will not const for non-constant references + typedef map > const map_type; + typedef identity_view transformed_type; + typedef boost::fusion::result_of::begin::type i_type; + typedef boost::fusion::result_of::deref_data::type r_type; + BOOST_STATIC_ASSERT((boost::is_same::value)); + } + + return boost::report_errors(); +} + From b0f60d59332adf6d90d96645d8d5ba3a10f7fbb8 Mon Sep 17 00:00:00 2001 From: Denis Mikhailov Date: Wed, 12 Jan 2022 09:48:26 +0400 Subject: [PATCH 15/28] Update identity_view.cpp --- test/sequence/identity_view.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/sequence/identity_view.cpp b/test/sequence/identity_view.cpp index 285b17e2..0ad33277 100644 --- a/test/sequence/identity_view.cpp +++ b/test/sequence/identity_view.cpp @@ -79,6 +79,15 @@ main() BOOST_MPL_ASSERT((boost::is_same::type, boost::mpl::integral_c&& >)); } + { + typedef vector sequence_type; + sequence_type seq; + identity_view ident(seq); + copy(make_vector(1, 2, 3, 4, 5), ident); + std::cout << seq << std::endl; + BOOST_TEST((seq == make_vector(1, 2, 3, 4, 5))); + } + /// Associative { typedef map< From d26c2e421281a9667bb81581978aa46507a8aa5e Mon Sep 17 00:00:00 2001 From: Denis Mikhailov Date: Wed, 12 Jan 2022 10:14:07 +0400 Subject: [PATCH 16/28] Update identity_view.cpp --- test/sequence/identity_view.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/test/sequence/identity_view.cpp b/test/sequence/identity_view.cpp index 0ad33277..1f8c3de2 100644 --- a/test/sequence/identity_view.cpp +++ b/test/sequence/identity_view.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include From 21a449ae469a5c8cf4656ee7fec334075bf0e820 Mon Sep 17 00:00:00 2001 From: denzor200 Date: Sat, 15 Jan 2022 22:22:46 +0400 Subject: [PATCH 17/28] [identity_view] Fix for spoiled prvalue --- .../view/identity_view/identity_view.hpp | 24 +++++++++++++++---- test/sequence/identity_view.cpp | 9 ++++--- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/include/boost/fusion/view/identity_view/identity_view.hpp b/include/boost/fusion/view/identity_view/identity_view.hpp index f26f2bc7..e7efdb7a 100644 --- a/include/boost/fusion/view/identity_view/identity_view.hpp +++ b/include/boost/fusion/view/identity_view/identity_view.hpp @@ -10,18 +10,34 @@ #include #include #include +#include + +namespace boost { namespace fusion { + namespace detail { + struct identity : boost::identity + { + }; + } +}} + +namespace boost { + template + struct result_of + { + typedef T type; + }; +} namespace boost { namespace fusion { template struct identity_view - : transform_view + : transform_view { - typedef transform_view base_type; + typedef transform_view base_type; BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED identity_view(Sequence& in_seq) - : base_type(in_seq, boost::identity()) {} + : base_type(in_seq, detail::identity()) {} }; - }} #endif diff --git a/test/sequence/identity_view.cpp b/test/sequence/identity_view.cpp index 1f8c3de2..e74f9294 100644 --- a/test/sequence/identity_view.cpp +++ b/test/sequence/identity_view.cpp @@ -77,7 +77,7 @@ main() BOOST_TEST((*boost::fusion::advance_c<3>(boost::fusion::begin(xform)) == 8)); BOOST_TEST((boost::fusion::at_c<2>(xform) == 7)); - BOOST_MPL_ASSERT((boost::is_same::type, boost::mpl::integral_c&& >)); + BOOST_MPL_ASSERT((boost::is_same::type, boost::mpl::integral_c >)); } { @@ -153,10 +153,9 @@ main() typedef boost::fusion::result_of::next::type second; typedef boost::fusion::result_of::next::type third; - // TODO: why is a boost::fusion::pair&& ?? - BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair&& >)); - BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair&& >)); - BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair&& >)); + BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair >)); + BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair >)); + BOOST_MPL_ASSERT((boost::is_same::type, boost::fusion::pair >)); } { From d22982e3a9f780a924d331fe5f87e125d9e69c8e Mon Sep 17 00:00:00 2001 From: denzor200 Date: Sun, 16 Jan 2022 09:49:05 +0400 Subject: [PATCH 18/28] Diff simplified && update copyrights --- .../view/reverse_view/detail/deref_data_impl.hpp | 10 +++++----- .../fusion/view/reverse_view/detail/key_of_impl.hpp | 2 +- .../view/reverse_view/detail/value_of_data_impl.hpp | 6 +++--- test/sequence/reverse_view.cpp | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/boost/fusion/view/reverse_view/detail/deref_data_impl.hpp b/include/boost/fusion/view/reverse_view/detail/deref_data_impl.hpp index e9bb9a02..db64d32b 100644 --- a/include/boost/fusion/view/reverse_view/detail/deref_data_impl.hpp +++ b/include/boost/fusion/view/reverse_view/detail/deref_data_impl.hpp @@ -1,6 +1,6 @@ /*============================================================================= Copyright (c) 2009 Christopher Schmidt - Copyright (c) 2021 Denis Mikhailov + Copyright (c) 2021-2022 Denis Mikhailov 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) @@ -21,22 +21,22 @@ namespace boost { namespace fusion { namespace extension template <> struct deref_data_impl { - template + template struct apply { typedef typename result_of::deref_data< typename result_of::prior< - typename Iterator::first_type + typename It::first_type >::type >::type type; BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type - call(Iterator const& i) + call(It const& it) { - return fusion::deref_data(fusion::prior(i.first)); + return fusion::deref_data(fusion::prior(it.first)); } }; }; diff --git a/include/boost/fusion/view/reverse_view/detail/key_of_impl.hpp b/include/boost/fusion/view/reverse_view/detail/key_of_impl.hpp index a2d8daef..0b8fc3bc 100644 --- a/include/boost/fusion/view/reverse_view/detail/key_of_impl.hpp +++ b/include/boost/fusion/view/reverse_view/detail/key_of_impl.hpp @@ -1,6 +1,6 @@ /*============================================================================= Copyright (c) 2009 Christopher Schmidt - Copyright (c) 2021 Denis Mikhailov + Copyright (c) 2021-2022 Denis Mikhailov 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) diff --git a/include/boost/fusion/view/reverse_view/detail/value_of_data_impl.hpp b/include/boost/fusion/view/reverse_view/detail/value_of_data_impl.hpp index c657f9e0..03cb753f 100644 --- a/include/boost/fusion/view/reverse_view/detail/value_of_data_impl.hpp +++ b/include/boost/fusion/view/reverse_view/detail/value_of_data_impl.hpp @@ -1,6 +1,6 @@ /*============================================================================= Copyright (c) 2009 Christopher Schmidt - Copyright (c) 2021 Denis Mikhailov + Copyright (c) 2021-2022 Denis Mikhailov 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) @@ -21,13 +21,13 @@ namespace boost { namespace fusion { namespace extension template <> struct value_of_data_impl { - template + template struct apply { typedef typename result_of::value_of_data< typename result_of::prior< - typename Iterator::first_type + typename It::first_type >::type >::type type; diff --git a/test/sequence/reverse_view.cpp b/test/sequence/reverse_view.cpp index b6afac99..aded1522 100644 --- a/test/sequence/reverse_view.cpp +++ b/test/sequence/reverse_view.cpp @@ -1,6 +1,6 @@ /*============================================================================= Copyright (c) 2001-2011 Joel de Guzman - Copyright (c) 2021 Denis Mikhailov + Copyright (c) 2021-2022 Denis Mikhailov 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) From d77dc74c7f66159c67a9dc051357f364c1c5c28e Mon Sep 17 00:00:00 2001 From: denzor200 Date: Mon, 24 Jan 2022 23:27:28 +0400 Subject: [PATCH 19/28] [githubactions] Fixed CI --- .github/workflows/ci.yml | 70 ++++++++++++++++++++++++++++------------ 1 file changed, 49 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b926e27..884233ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,8 @@ jobs: buildtype: "boost" packages: "g++-4.4" packages_to_remove: "" - os: "ubuntu-16.04" + os: "ubuntu-20.04" + container: "ubuntu:16.04" cxx: "g++" sources: "" llvm_os: "" @@ -32,7 +33,8 @@ jobs: buildtype: "boost" packages: "g++-4.6" packages_to_remove: "" - os: "ubuntu-16.04" + os: "ubuntu-20.04" + container: "ubuntu:16.04" cxx: "g++" sources: "" llvm_os: "" @@ -43,7 +45,8 @@ jobs: buildtype: "boost" packages: "g++-4.7" packages_to_remove: "" - os: "ubuntu-16.04" + os: "ubuntu-20.04" + container: "ubuntu:16.04" cxx: "g++" sources: "" llvm_os: "" @@ -54,7 +57,8 @@ jobs: buildtype: "boost" packages: "g++-4.8" packages_to_remove: "" - os: "ubuntu-16.04" + os: "ubuntu-20.04" + container: "ubuntu:16.04" cxx: "g++" sources: "" llvm_os: "" @@ -65,7 +69,8 @@ jobs: buildtype: "boost" packages: "g++-4.9" packages_to_remove: "" - os: "ubuntu-16.04" + os: "ubuntu-20.04" + container: "ubuntu:16.04" cxx: "g++" sources: "" llvm_os: "" @@ -76,7 +81,8 @@ jobs: buildtype: "boost" packages: "g++-5" packages_to_remove: "" - os: "ubuntu-16.04" + os: "ubuntu-20.04" + container: "ubuntu:16.04" cxx: "g++" sources: "" llvm_os: "" @@ -87,7 +93,8 @@ jobs: buildtype: "boost" packages: "g++-6" packages_to_remove: "" - os: "ubuntu-16.04" + os: "ubuntu-20.04" + container: "ubuntu:16.04" cxx: "g++" sources: "" llvm_os: "" @@ -98,7 +105,8 @@ jobs: buildtype: "boost" packages: "g++-7" packages_to_remove: "" - os: "ubuntu-16.04" + os: "ubuntu-20.04" + container: "ubuntu:16.04" cxx: "g++" sources: "" llvm_os: "" @@ -109,7 +117,8 @@ jobs: buildtype: "boost" packages: "g++-8" packages_to_remove: "" - os: "ubuntu-16.04" + os: "ubuntu-20.04" + container: "ubuntu:16.04" cxx: "g++" sources: "" llvm_os: "" @@ -120,7 +129,8 @@ jobs: buildtype: "boost" packages: "clang-3.5" packages_to_remove: "" - os: "ubuntu-16.04" + os: "ubuntu-20.04" + container: "ubuntu:16.04" cxx: "g++" sources: "" llvm_os: "" @@ -131,7 +141,8 @@ jobs: buildtype: "boost" packages: "clang-3.6" packages_to_remove: "" - os: "ubuntu-16.04" + os: "ubuntu-20.04" + container: "ubuntu:16.04" cxx: "g++" sources: "" llvm_os: "" @@ -142,7 +153,8 @@ jobs: buildtype: "boost" packages: "clang-3.7" packages_to_remove: "" - os: "ubuntu-16.04" + os: "ubuntu-20.04" + container: "ubuntu:16.04" cxx: "g++" sources: "" llvm_os: "" @@ -153,7 +165,8 @@ jobs: buildtype: "boost" packages: "clang-3.8" packages_to_remove: "" - os: "ubuntu-16.04" + os: "ubuntu-20.04" + container: "ubuntu:16.04" cxx: "g++" sources: "" llvm_os: "" @@ -164,7 +177,8 @@ jobs: buildtype: "boost" packages: "clang-3.9" packages_to_remove: "" - os: "ubuntu-16.04" + os: "ubuntu-20.04" + container: "ubuntu:16.04" cxx: "g++" sources: "" llvm_os: "" @@ -175,7 +189,8 @@ jobs: buildtype: "boost" packages: "clang-4.0" packages_to_remove: "" - os: "ubuntu-16.04" + os: "ubuntu-20.04" + container: "ubuntu:16.04" cxx: "g++" sources: "" llvm_os: "" @@ -186,7 +201,8 @@ jobs: buildtype: "boost" packages: "clang-5.0" packages_to_remove: "" - os: "ubuntu-16.04" + os: "ubuntu-20.04" + container: "ubuntu:16.04" cxx: "g++" sources: "" llvm_os: "xenial" @@ -197,23 +213,25 @@ jobs: buildtype: "boost" packages: "clang-6.0" packages_to_remove: "" - os: "ubuntu-16.04" + os: "ubuntu-20.04" + container: "ubuntu:16.04" cxx: "g++" sources: "" llvm_os: "xenial" llvm_ver: "6.0" toolset: "clang-6.0" cxxstd: "03,11,14,17,2a" - - name: "TOOLSET=clang-7.0 CXXSTD=03,11,14,17,2a Job 17" + - name: "TOOLSET=clang-7 CXXSTD=03,11,14,17,2a Job 17" buildtype: "boost" packages: "clang-7" packages_to_remove: "" - os: "ubuntu-16.04" + os: "ubuntu-20.04" + container: "ubuntu:16.04" cxx: "g++" sources: "" llvm_os: "xenial" llvm_ver: "7" - toolset: "clang-7.0" + toolset: "clang-7" cxxstd: "03,11,14,17,2a" runs-on: ${{ matrix.os }} @@ -223,6 +241,16 @@ jobs: - name: Check if running in container if: matrix.container != '' run: echo "GHA_CONTAINER=${{ matrix.container }}" >> $GITHUB_ENV + - name: If running in container, upgrade packages + if: matrix.container != '' + run: | + apt-get -o Acquire::Retries=3 update && DEBIAN_FRONTEND=noninteractive apt-get -y install tzdata && apt-get -o Acquire::Retries=3 install -y sudo software-properties-common wget curl apt-transport-https make apt-file sudo unzip libssl-dev build-essential autotools-dev autoconf automake g++ libc++-helpers python ruby cpio gcc-multilib g++-multilib pkgconf python3 ccache libpython-dev + sudo apt-add-repository ppa:git-core/ppa + sudo apt-get -o Acquire::Retries=3 update && apt-get -o Acquire::Retries=3 -y install git + python_version=$(python3 -c 'import sys; print("{0.major}.{0.minor}".format(sys.version_info))') + sudo wget https://bootstrap.pypa.io/pip/$python_version/get-pip.py + sudo python3 get-pip.py + sudo /usr/local/bin/pip install cmake - uses: actions/checkout@v2 @@ -436,4 +464,4 @@ jobs: ./b2 -j`(nproc || sysctl -n hw.ncpu) 2> /dev/null` libs/fusion/test toolset=$TOOLSET cxxstd=$CXXSTD - fi + fi \ No newline at end of file From 145b54d0607a1011b19e024cbbd7f633ace04ef4 Mon Sep 17 00:00:00 2001 From: denzor200 Date: Mon, 24 Jan 2022 23:40:18 +0400 Subject: [PATCH 20/28] [githubactions] Fixed reverse_view test for C++03 --- test/sequence/reverse_view.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sequence/reverse_view.cpp b/test/sequence/reverse_view.cpp index aded1522..356b9b0b 100644 --- a/test/sequence/reverse_view.cpp +++ b/test/sequence/reverse_view.cpp @@ -119,7 +119,7 @@ main() && at_key< boost::mpl::int_<0> >(rev) == "new_zero" )); BOOST_MPL_ASSERT((boost::mpl::and_ > , boost::mpl::not_ > > >)); - BOOST_MPL_ASSERT((boost::is_same>::type, std::string&>)); + BOOST_MPL_ASSERT((boost::is_same >::type, std::string&>)); BOOST_MPL_ASSERT((boost::is_same >::type, std::string>)); } From 8e58e09ba7ba4bbe7d639579e1b12986d720dbc0 Mon Sep 17 00:00:00 2001 From: fanquake Date: Fri, 8 Apr 2022 15:00:20 +0100 Subject: [PATCH 21/28] refactor: use core/ref.hpp over ref.hpp The later has been deprecated: ```cpp // The header file at this path is deprecated; // use boost/core/ref.hpp instead. ``` --- example/cookbook/do_the_bind.cpp | 2 +- include/boost/fusion/support/deduce.hpp | 2 +- include/boost/fusion/support/detail/as_fusion_element.hpp | 2 +- test/functional/make_unfused.cpp | 2 +- test/sequence/deduce_sequence.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/example/cookbook/do_the_bind.cpp b/example/cookbook/do_the_bind.cpp index ac5baee4..8458e64b 100644 --- a/example/cookbook/do_the_bind.cpp +++ b/example/cookbook/do_the_bind.cpp @@ -46,7 +46,7 @@ #include #include -#include +#include #include #include diff --git a/include/boost/fusion/support/deduce.hpp b/include/boost/fusion/support/deduce.hpp index b75381c5..ee7e3dc9 100644 --- a/include/boost/fusion/support/deduce.hpp +++ b/include/boost/fusion/support/deduce.hpp @@ -10,7 +10,7 @@ #define BOOST_FUSION_SUPPORT_DEDUCE_HPP_INCLUDED #include -#include +#include #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL #include diff --git a/include/boost/fusion/support/detail/as_fusion_element.hpp b/include/boost/fusion/support/detail/as_fusion_element.hpp index 2af960ee..08f4db92 100644 --- a/include/boost/fusion/support/detail/as_fusion_element.hpp +++ b/include/boost/fusion/support/detail/as_fusion_element.hpp @@ -9,7 +9,7 @@ #define FUSION_AS_FUSION_ELEMENT_05052005_0338 #include -#include +#include #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL #include diff --git a/test/functional/make_unfused.cpp b/test/functional/make_unfused.cpp index 73be142b..6ed38289 100644 --- a/test/functional/make_unfused.cpp +++ b/test/functional/make_unfused.cpp @@ -19,11 +19,11 @@ #include #include +#include #include #include -#include namespace fusion = boost::fusion; namespace mpl = boost::mpl; diff --git a/test/sequence/deduce_sequence.cpp b/test/sequence/deduce_sequence.cpp index a1569f46..3bccc20a 100644 --- a/test/sequence/deduce_sequence.cpp +++ b/test/sequence/deduce_sequence.cpp @@ -13,7 +13,7 @@ #include -#include +#include #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL #include #endif From 6da4ec1ae5cf43b8e23348a413ecc4eeea92d8b2 Mon Sep 17 00:00:00 2001 From: fanquake Date: Fri, 8 Apr 2022 15:02:43 +0100 Subject: [PATCH 22/28] refactor: use core/noncopyable over noncopyable The later is deprecated: ```cpp // The header file at this path is deprecated; // use boost/core/noncopyable.hpp instead. ``` --- test/functional/fused.cpp | 2 +- test/functional/fused_function_object.cpp | 2 +- test/functional/fused_procedure.cpp | 2 +- test/functional/invoke.cpp | 2 +- test/functional/invoke_function_object.cpp | 2 +- test/functional/invoke_procedure.cpp | 2 +- test/functional/make_fused.cpp | 2 +- test/functional/make_fused_function_object.cpp | 2 +- test/functional/make_fused_procedure.cpp | 2 +- test/functional/make_unfused.cpp | 2 +- test/functional/unfused.cpp | 2 +- test/functional/unfused_typed.cpp | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/functional/fused.cpp b/test/functional/fused.cpp index b2ce8dde..63a47348 100644 --- a/test/functional/fused.cpp +++ b/test/functional/fused.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/test/functional/fused_function_object.cpp b/test/functional/fused_function_object.cpp index 399745a0..cd3e2ea9 100644 --- a/test/functional/fused_function_object.cpp +++ b/test/functional/fused_function_object.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/test/functional/fused_procedure.cpp b/test/functional/fused_procedure.cpp index 1ed0ddf7..07b84e43 100644 --- a/test/functional/fused_procedure.cpp +++ b/test/functional/fused_procedure.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/test/functional/invoke.cpp b/test/functional/invoke.cpp index 3117eb3f..af3b813f 100644 --- a/test/functional/invoke.cpp +++ b/test/functional/invoke.cpp @@ -16,7 +16,7 @@ #endif #include -#include +#include #include diff --git a/test/functional/invoke_function_object.cpp b/test/functional/invoke_function_object.cpp index 7c75f06d..54cefc38 100644 --- a/test/functional/invoke_function_object.cpp +++ b/test/functional/invoke_function_object.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include diff --git a/test/functional/invoke_procedure.cpp b/test/functional/invoke_procedure.cpp index 3877ca30..a608e304 100644 --- a/test/functional/invoke_procedure.cpp +++ b/test/functional/invoke_procedure.cpp @@ -16,7 +16,7 @@ #endif #include -#include +#include #include diff --git a/test/functional/make_fused.cpp b/test/functional/make_fused.cpp index ceb82063..6503ee28 100644 --- a/test/functional/make_fused.cpp +++ b/test/functional/make_fused.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/test/functional/make_fused_function_object.cpp b/test/functional/make_fused_function_object.cpp index 79ea517b..9f803c4d 100644 --- a/test/functional/make_fused_function_object.cpp +++ b/test/functional/make_fused_function_object.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/test/functional/make_fused_procedure.cpp b/test/functional/make_fused_procedure.cpp index 2fa2762c..51a82f78 100644 --- a/test/functional/make_fused_procedure.cpp +++ b/test/functional/make_fused_procedure.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/test/functional/make_unfused.cpp b/test/functional/make_unfused.cpp index 6ed38289..b8ee9938 100644 --- a/test/functional/make_unfused.cpp +++ b/test/functional/make_unfused.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/test/functional/unfused.cpp b/test/functional/unfused.cpp index 1e30eabd..21c0d42e 100644 --- a/test/functional/unfused.cpp +++ b/test/functional/unfused.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/test/functional/unfused_typed.cpp b/test/functional/unfused_typed.cpp index eaa03425..a0f76d49 100644 --- a/test/functional/unfused_typed.cpp +++ b/test/functional/unfused_typed.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include From 283d1a62c41d57fb9164ee6a7b80ba01b4668eeb Mon Sep 17 00:00:00 2001 From: Denis Mikhailov Date: Mon, 4 Jul 2022 16:25:03 +0600 Subject: [PATCH 23/28] Added functional dependency to develop --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 707b4f89..9dd1d3ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,4 +23,5 @@ target_link_libraries(boost_fusion Boost::type_traits Boost::typeof Boost::utility + Boost::functional ) From 7fe4a887aeb5587e108784f98bb023fa83a9e31f Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Sun, 16 Jan 2022 22:52:11 +0300 Subject: [PATCH 24/28] Fix Clang 13 `-Wdeprecated-copy` warnings Clang 13 have new warning under the same group --- .../adapted/boost_array/array_iterator.hpp | 11 +++++++++-- .../boost_tuple/boost_tuple_iterator.hpp | 10 +++++++--- .../adapted/std_array/std_array_iterator.hpp | 11 +++++++++-- .../adapted/std_tuple/std_tuple_iterator.hpp | 9 +++++++++ .../struct/detail/define_struct_inline.hpp | 8 +++++++- .../fusion/adapted/struct/detail/proxy_type.hpp | 7 +++++-- .../iteration/detail/segmented_fold.hpp | 7 +++++++ .../iteration/detail/segmented_for_each.hpp | 9 +++++++++ .../algorithm/transformation/pop_back.hpp | 9 +++++++++ .../fusion/container/deque/deque_iterator.hpp | 12 +++++++++--- .../fusion/container/list/cons_iterator.hpp | 10 +++++++--- .../boost/fusion/container/map/map_iterator.hpp | 13 +++++++++---- .../fusion/container/vector/vector_iterator.hpp | 16 +++++++++------- .../fusion/iterator/detail/segment_sequence.hpp | 9 +++++++++ .../boost/fusion/iterator/iterator_adapter.hpp | 9 +++++++++ .../boost/fusion/sequence/io/detail/manip.hpp | 10 +++++++--- include/boost/fusion/support/config.hpp | 10 ++++++++++ .../fusion/view/filter_view/filter_view.hpp | 17 +++++++++-------- .../view/filter_view/filter_view_iterator.hpp | 16 +++++++++------- .../fusion/view/flatten_view/flatten_view.hpp | 8 ++++++++ .../view/flatten_view/flatten_view_iterator.hpp | 8 ++++++++ .../fusion/view/identity_view/identity_view.hpp | 7 +++++++ .../boost/fusion/view/joint_view/joint_view.hpp | 12 +++++++++--- .../view/joint_view/joint_view_iterator.hpp | 12 +++++++++--- .../boost/fusion/view/nview/nview_iterator.hpp | 12 +++++++++--- .../view/repetitive_view/repetitive_view.hpp | 11 ++++++++--- .../repetitive_view_iterator.hpp | 12 +++++++++--- .../fusion/view/reverse_view/reverse_view.hpp | 12 +++++++++--- .../view/reverse_view/reverse_view_iterator.hpp | 12 +++++++++--- .../view/single_view/single_view_iterator.hpp | 11 +++++++++-- .../view/transform_view/transform_view.hpp | 15 +++++++++------ .../transform_view/transform_view_iterator.hpp | 15 +++++++++------ test/sequence/segmented_iterator_range.cpp | 7 +++++++ 33 files changed, 277 insertions(+), 80 deletions(-) diff --git a/include/boost/fusion/adapted/boost_array/array_iterator.hpp b/include/boost/fusion/adapted/boost_array/array_iterator.hpp index 540cbfed..546d16f0 100644 --- a/include/boost/fusion/adapted/boost_array/array_iterator.hpp +++ b/include/boost/fusion/adapted/boost_array/array_iterator.hpp @@ -18,6 +18,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { struct random_access_traversal_tag; @@ -102,11 +107,13 @@ namespace boost { namespace fusion return type(); } }; - - BOOST_DELETED_FUNCTION(array_iterator& operator=(array_iterator const&)) }; }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408 namespace std { diff --git a/include/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp b/include/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp index ea30cb55..024d8720 100644 --- a/include/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp +++ b/include/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp @@ -45,6 +45,10 @@ namespace boost { namespace fusion template struct boost_tuple_iterator_identity; +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif template struct boost_tuple_iterator : iterator_facade, forward_traversal_tag> @@ -143,10 +147,10 @@ namespace boost { namespace fusion struct equal_to : is_same {}; - - // silence MSVC warning C4512: assignment operator could not be generated - BOOST_DELETED_FUNCTION(boost_tuple_iterator& operator= (boost_tuple_iterator const&)) }; +#ifdef _MSC_VER +# pragma warning(pop) +#endif template struct boost_tuple_null_iterator diff --git a/include/boost/fusion/adapted/std_array/std_array_iterator.hpp b/include/boost/fusion/adapted/std_array/std_array_iterator.hpp index 4fac5707..eaf45116 100644 --- a/include/boost/fusion/adapted/std_array/std_array_iterator.hpp +++ b/include/boost/fusion/adapted/std_array/std_array_iterator.hpp @@ -19,6 +19,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { struct random_access_traversal_tag; @@ -99,9 +104,11 @@ namespace boost { namespace fusion return type(); } }; - - BOOST_DELETED_FUNCTION(std_array_iterator& operator=(std_array_iterator const&)) }; }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #endif diff --git a/include/boost/fusion/adapted/std_tuple/std_tuple_iterator.hpp b/include/boost/fusion/adapted/std_tuple/std_tuple_iterator.hpp index a3421e0f..c84c8470 100644 --- a/include/boost/fusion/adapted/std_tuple/std_tuple_iterator.hpp +++ b/include/boost/fusion/adapted/std_tuple/std_tuple_iterator.hpp @@ -17,6 +17,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { struct random_access_traversal_tag; @@ -107,6 +112,10 @@ namespace boost { namespace fusion }; }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408 namespace std { diff --git a/include/boost/fusion/adapted/struct/detail/define_struct_inline.hpp b/include/boost/fusion/adapted/struct/detail/define_struct_inline.hpp index 1db1a2ef..af711015 100644 --- a/include/boost/fusion/adapted/struct/detail/define_struct_inline.hpp +++ b/include/boost/fusion/adapted/struct/detail/define_struct_inline.hpp @@ -326,6 +326,9 @@ #define BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR_IMPL_IMPL( \ NAME, ATTRIBUTES_SEQ, ATTRIBUTES_SEQ_SIZE) \ \ + BOOST_FUSION_PUSH_WARNINGS \ + BOOST_FUSION_DISABLE_MSVC_WARNING(4512) \ + \ template \ struct BOOST_FUSION_ITERATOR_NAME(NAME) \ : boost::fusion::iterator_facade< \ @@ -418,7 +421,10 @@ return type(it.seq_); \ } \ }; \ - }; + }; \ + \ + BOOST_FUSION_POP_WARNINGS \ + /**/ #define BOOST_FUSION_DEFINE_STRUCT_INLINE_MEMBERS_IMPL_IMPL( \ diff --git a/include/boost/fusion/adapted/struct/detail/proxy_type.hpp b/include/boost/fusion/adapted/struct/detail/proxy_type.hpp index 1679561b..e0645173 100644 --- a/include/boost/fusion/adapted/struct/detail/proxy_type.hpp +++ b/include/boost/fusion/adapted/struct/detail/proxy_type.hpp @@ -19,6 +19,9 @@ \ BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DEFINITION_BEGIN(NAMESPACE_SEQ) \ \ + BOOST_FUSION_PUSH_WARNINGS \ + BOOST_FUSION_DISABLE_MSVC_WARNING(4512) \ + \ struct NAME \ { \ BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \ @@ -27,10 +30,10 @@ {} \ \ WRAPPED_TYPE& obj; \ - \ - BOOST_DELETED_FUNCTION(NAME& operator= (NAME const&)) \ }; \ \ + BOOST_FUSION_POP_WARNINGS \ + \ BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DEFINITION_END(NAMESPACE_SEQ) #define BOOST_FUSION_ADAPT_STRUCT_DEFINE_PROXY_TYPE( \ diff --git a/include/boost/fusion/algorithm/iteration/detail/segmented_fold.hpp b/include/boost/fusion/algorithm/iteration/detail/segmented_fold.hpp index 350bff75..663c6fed 100644 --- a/include/boost/fusion/algorithm/iteration/detail/segmented_fold.hpp +++ b/include/boost/fusion/algorithm/iteration/detail/segmented_fold.hpp @@ -14,6 +14,10 @@ namespace boost { namespace fusion { namespace detail { +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif template struct segmented_fold_fun { @@ -37,6 +41,9 @@ namespace boost { namespace fusion { namespace detail } }; }; +#ifdef _MSC_VER +# pragma warning(pop) +#endif // The default implementation of this lives in detail/fold.hpp template diff --git a/include/boost/fusion/algorithm/iteration/detail/segmented_for_each.hpp b/include/boost/fusion/algorithm/iteration/detail/segmented_for_each.hpp index 7b299f86..404ba2a0 100644 --- a/include/boost/fusion/algorithm/iteration/detail/segmented_for_each.hpp +++ b/include/boost/fusion/algorithm/iteration/detail/segmented_for_each.hpp @@ -13,6 +13,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { namespace detail { template @@ -49,4 +54,8 @@ namespace boost { namespace fusion { namespace detail } }}} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #endif diff --git a/include/boost/fusion/algorithm/transformation/pop_back.hpp b/include/boost/fusion/algorithm/transformation/pop_back.hpp index 2f55fa5e..9a7e7547 100644 --- a/include/boost/fusion/algorithm/transformation/pop_back.hpp +++ b/include/boost/fusion/algorithm/transformation/pop_back.hpp @@ -18,6 +18,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { template @@ -168,5 +173,9 @@ namespace boost { namespace fusion } }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #endif diff --git a/include/boost/fusion/container/deque/deque_iterator.hpp b/include/boost/fusion/container/deque/deque_iterator.hpp index b0335e5f..66fd635d 100644 --- a/include/boost/fusion/container/deque/deque_iterator.hpp +++ b/include/boost/fusion/container/deque/deque_iterator.hpp @@ -20,6 +20,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { struct bidirectional_traversal_tag; @@ -110,13 +115,14 @@ namespace boost { namespace fusion { {}; Seq& seq_; - - // silence MSVC warning C4512: assignment operator could not be generated - BOOST_DELETED_FUNCTION(deque_iterator& operator= (deque_iterator const&)) }; }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408 namespace std { diff --git a/include/boost/fusion/container/list/cons_iterator.hpp b/include/boost/fusion/container/list/cons_iterator.hpp index 5c0491db..f6655a70 100644 --- a/include/boost/fusion/container/list/cons_iterator.hpp +++ b/include/boost/fusion/container/list/cons_iterator.hpp @@ -26,6 +26,10 @@ namespace boost { namespace fusion template struct cons_iterator_identity; +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif template struct cons_iterator : iterator_base > { @@ -41,10 +45,10 @@ namespace boost { namespace fusion : cons(in_cons) {} cons_type& cons; - - // silence MSVC warning C4512: assignment operator could not be generated - BOOST_DELETED_FUNCTION(cons_iterator& operator= (cons_iterator const&)) }; +#ifdef _MSC_VER +# pragma warning(pop) +#endif struct nil_iterator : iterator_base { diff --git a/include/boost/fusion/container/map/map_iterator.hpp b/include/boost/fusion/container/map/map_iterator.hpp index 3db7344b..3ae0decd 100644 --- a/include/boost/fusion/container/map/map_iterator.hpp +++ b/include/boost/fusion/container/map/map_iterator.hpp @@ -17,6 +17,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { struct random_access_traversal_tag; @@ -155,13 +160,13 @@ namespace boost { namespace fusion {}; Seq& seq_; - - // silence MSVC warning C4512: assignment operator could not be generated - BOOST_DELETED_FUNCTION(map_iterator& operator= (map_iterator const&)) }; - }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408 namespace std { diff --git a/include/boost/fusion/container/vector/vector_iterator.hpp b/include/boost/fusion/container/vector/vector_iterator.hpp index 0e04b345..62219766 100644 --- a/include/boost/fusion/container/vector/vector_iterator.hpp +++ b/include/boost/fusion/container/vector/vector_iterator.hpp @@ -19,6 +19,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { struct vector_iterator_tag; @@ -41,17 +46,14 @@ namespace boost { namespace fusion vector_iterator(Vector& in_vec) : vec(in_vec) {} - BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED - vector_iterator(vector_iterator const& rhs) - : vec(rhs.vec) {} - Vector& vec; - - // silence MSVC warning C4512: assignment operator could not be generated - BOOST_DELETED_FUNCTION(vector_iterator& operator= (vector_iterator const&)) }; }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408 namespace std { diff --git a/include/boost/fusion/iterator/detail/segment_sequence.hpp b/include/boost/fusion/iterator/detail/segment_sequence.hpp index 8b8d5c13..8b45cc13 100644 --- a/include/boost/fusion/iterator/detail/segment_sequence.hpp +++ b/include/boost/fusion/iterator/detail/segment_sequence.hpp @@ -13,6 +13,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { namespace detail { struct segment_sequence_tag {}; @@ -36,6 +41,10 @@ namespace boost { namespace fusion { namespace detail }; } +#ifdef _MSC_VER +# pragma warning(pop) +#endif + namespace extension { template diff --git a/include/boost/fusion/iterator/iterator_adapter.hpp b/include/boost/fusion/iterator/iterator_adapter.hpp index de8938f6..999d57b2 100644 --- a/include/boost/fusion/iterator/iterator_adapter.hpp +++ b/include/boost/fusion/iterator/iterator_adapter.hpp @@ -19,6 +19,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { template class string_ios_manip { @@ -143,10 +147,10 @@ namespace boost { namespace fusion } Stream& stream; - - // silence MSVC warning C4512: assignment operator could not be generated - BOOST_DELETED_FUNCTION(string_ios_manip& operator= (string_ios_manip const&)) }; +#ifdef _MSC_VER +# pragma warning(pop) +#endif } // detail diff --git a/include/boost/fusion/support/config.hpp b/include/boost/fusion/support/config.hpp index dc614d9d..7c87adeb 100644 --- a/include/boost/fusion/support/config.hpp +++ b/include/boost/fusion/support/config.hpp @@ -127,4 +127,14 @@ namespace boost { namespace fusion { namespace detail # define BOOST_FUSION_NOEXCEPT_ON_DEFAULTED BOOST_NOEXCEPT #endif +#ifdef _MSC_VER +# define BOOST_FUSION_PUSH_WARNINGS __pragma(warning(push)) +# define BOOST_FUSION_POP_WARNINGS __pragma(warning(pop)) +# define BOOST_FUSION_DISABLE_MSVC_WARNING(num) __pragma(warning(disable : num)) +#else +# define BOOST_FUSION_PUSH_WARNINGS +# define BOOST_FUSION_POP_WARNINGS +# define BOOST_FUSION_DISABLE_MSVC_WARNING(num) +#endif + #endif diff --git a/include/boost/fusion/view/filter_view/filter_view.hpp b/include/boost/fusion/view/filter_view/filter_view.hpp index b9b7e7fc..c4e05e8d 100644 --- a/include/boost/fusion/view/filter_view/filter_view.hpp +++ b/include/boost/fusion/view/filter_view/filter_view.hpp @@ -22,6 +22,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { struct filter_view_tag; @@ -51,22 +56,18 @@ namespace boost { namespace fusion : seq(in_seq) {} - BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED - filter_view(filter_view const& rhs) - : seq(rhs.seq) - {} - BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED first_type first() const { return fusion::begin(seq); } BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED last_type last() const { return fusion::end(seq); } typename mpl::if_, Sequence, Sequence&>::type seq; - - // silence MSVC warning C4512: assignment operator could not be generated - BOOST_DELETED_FUNCTION(filter_view& operator= (filter_view const&)) }; }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #endif diff --git a/include/boost/fusion/view/filter_view/filter_view_iterator.hpp b/include/boost/fusion/view/filter_view/filter_view_iterator.hpp index 05eda69b..7a907f50 100644 --- a/include/boost/fusion/view/filter_view/filter_view_iterator.hpp +++ b/include/boost/fusion/view/filter_view/filter_view_iterator.hpp @@ -26,6 +26,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { struct filter_view_iterator_tag; @@ -59,17 +64,14 @@ namespace boost { namespace fusion filter_iterator(First const& in_first) : first(filter::iter_call(first_converter::call(in_first))) {} - BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED - filter_iterator(filter_iterator const& rhs) - : first(rhs.first) {} - first_type first; - - // silence MSVC warning C4512: assignment operator could not be generated - BOOST_DELETED_FUNCTION(filter_iterator& operator= (filter_iterator const&)) }; }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408 namespace std { diff --git a/include/boost/fusion/view/flatten_view/flatten_view.hpp b/include/boost/fusion/view/flatten_view/flatten_view.hpp index 401f65dc..4512a137 100644 --- a/include/boost/fusion/view/flatten_view/flatten_view.hpp +++ b/include/boost/fusion/view/flatten_view/flatten_view.hpp @@ -19,6 +19,10 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif namespace boost { namespace fusion { @@ -52,6 +56,10 @@ namespace boost { namespace fusion }; }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + namespace boost { namespace fusion { namespace extension { template<> diff --git a/include/boost/fusion/view/flatten_view/flatten_view_iterator.hpp b/include/boost/fusion/view/flatten_view/flatten_view_iterator.hpp index be115d91..73d2490b 100644 --- a/include/boost/fusion/view/flatten_view/flatten_view_iterator.hpp +++ b/include/boost/fusion/view/flatten_view/flatten_view_iterator.hpp @@ -19,6 +19,10 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif namespace boost { namespace fusion { @@ -46,6 +50,10 @@ namespace boost { namespace fusion }; }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + namespace boost { namespace fusion { namespace detail { template diff --git a/include/boost/fusion/view/identity_view/identity_view.hpp b/include/boost/fusion/view/identity_view/identity_view.hpp index e7efdb7a..4cd0c093 100644 --- a/include/boost/fusion/view/identity_view/identity_view.hpp +++ b/include/boost/fusion/view/identity_view/identity_view.hpp @@ -28,6 +28,10 @@ namespace boost { }; } +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif namespace boost { namespace fusion { template struct identity_view : transform_view @@ -39,5 +43,8 @@ namespace boost { namespace fusion { : base_type(in_seq, detail::identity()) {} }; }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif #endif diff --git a/include/boost/fusion/view/joint_view/joint_view.hpp b/include/boost/fusion/view/joint_view/joint_view.hpp index 03e38d69..1cf6d0d5 100644 --- a/include/boost/fusion/view/joint_view/joint_view.hpp +++ b/include/boost/fusion/view/joint_view/joint_view.hpp @@ -25,6 +25,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { struct joint_view_tag; @@ -69,15 +74,16 @@ namespace boost { namespace fusion BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED concat_last_type concat_last() const { return fusion::end(seq2); } - // silence MSVC warning C4512: assignment operator could not be generated - BOOST_DELETED_FUNCTION(joint_view& operator= (joint_view const&)) - private: typename mpl::if_, Sequence1, Sequence1&>::type seq1; typename mpl::if_, Sequence2, Sequence2&>::type seq2; }; }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #endif diff --git a/include/boost/fusion/view/joint_view/joint_view_iterator.hpp b/include/boost/fusion/view/joint_view/joint_view_iterator.hpp index f6db3091..1b446189 100644 --- a/include/boost/fusion/view/joint_view/joint_view_iterator.hpp +++ b/include/boost/fusion/view/joint_view/joint_view_iterator.hpp @@ -20,6 +20,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { struct joint_view_iterator_tag; @@ -49,12 +54,13 @@ namespace boost { namespace fusion first_type first; concat_type concat; - - // silence MSVC warning C4512: assignment operator could not be generated - BOOST_DELETED_FUNCTION(joint_view_iterator& operator= (joint_view_iterator const&)) }; }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408 namespace std { diff --git a/include/boost/fusion/view/nview/nview_iterator.hpp b/include/boost/fusion/view/nview/nview_iterator.hpp index 79c82dd9..5e5cea27 100644 --- a/include/boost/fusion/view/nview/nview_iterator.hpp +++ b/include/boost/fusion/view/nview/nview_iterator.hpp @@ -26,6 +26,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { struct nview_iterator_tag; @@ -46,13 +51,14 @@ namespace boost { namespace fusion : seq(in_seq) {} Sequence& seq; - - // silence MSVC warning C4512: assignment operator could not be generated - BOOST_DELETED_FUNCTION(nview_iterator& operator= (nview_iterator const&)) }; }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408 namespace std { diff --git a/include/boost/fusion/view/repetitive_view/repetitive_view.hpp b/include/boost/fusion/view/repetitive_view/repetitive_view.hpp index 71dc51bc..615fa581 100644 --- a/include/boost/fusion/view/repetitive_view/repetitive_view.hpp +++ b/include/boost/fusion/view/repetitive_view/repetitive_view.hpp @@ -18,6 +18,10 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif namespace boost { namespace fusion { @@ -43,11 +47,12 @@ namespace boost { namespace fusion : seq(in_seq) {} stored_seq_type seq; - - // silence MSVC warning C4512: assignment operator could not be generated - BOOST_DELETED_FUNCTION(repetitive_view& operator= (repetitive_view const&)) }; }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #endif diff --git a/include/boost/fusion/view/repetitive_view/repetitive_view_iterator.hpp b/include/boost/fusion/view/repetitive_view/repetitive_view_iterator.hpp index 775249ff..842d3fb1 100644 --- a/include/boost/fusion/view/repetitive_view/repetitive_view_iterator.hpp +++ b/include/boost/fusion/view/repetitive_view/repetitive_view_iterator.hpp @@ -19,6 +19,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { struct repetitive_view_iterator_tag; @@ -46,12 +51,13 @@ namespace boost { namespace fusion Sequence& seq; pos_type pos; - - // silence MSVC warning C4512: assignment operator could not be generated - BOOST_DELETED_FUNCTION(repetitive_view_iterator& operator= (repetitive_view_iterator const&)) }; }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408 namespace std { diff --git a/include/boost/fusion/view/reverse_view/reverse_view.hpp b/include/boost/fusion/view/reverse_view/reverse_view.hpp index 0aa3d106..cde4206f 100644 --- a/include/boost/fusion/view/reverse_view/reverse_view.hpp +++ b/include/boost/fusion/view/reverse_view/reverse_view.hpp @@ -27,6 +27,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { struct reverse_view_tag; @@ -60,12 +65,13 @@ namespace boost { namespace fusion BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED last_type last() const { return fusion::end(seq); } typename mpl::if_, Sequence, Sequence&>::type seq; - - // silence MSVC warning C4512: assignment operator could not be generated - BOOST_DELETED_FUNCTION(reverse_view& operator= (reverse_view const&)) }; }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #endif diff --git a/include/boost/fusion/view/reverse_view/reverse_view_iterator.hpp b/include/boost/fusion/view/reverse_view/reverse_view_iterator.hpp index 0a582f40..02307f5a 100644 --- a/include/boost/fusion/view/reverse_view/reverse_view_iterator.hpp +++ b/include/boost/fusion/view/reverse_view/reverse_view_iterator.hpp @@ -24,6 +24,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { struct reverse_view_iterator_tag; @@ -47,12 +52,13 @@ namespace boost { namespace fusion : first(converter::call(in_first)) {} first_type first; - - // silence MSVC warning C4512: assignment operator could not be generated - BOOST_DELETED_FUNCTION(reverse_view_iterator& operator= (reverse_view_iterator const&)) }; }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408 namespace std { diff --git a/include/boost/fusion/view/single_view/single_view_iterator.hpp b/include/boost/fusion/view/single_view/single_view_iterator.hpp index 0de6c842..38c25ed5 100644 --- a/include/boost/fusion/view/single_view/single_view_iterator.hpp +++ b/include/boost/fusion/view/single_view/single_view_iterator.hpp @@ -20,6 +20,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { struct single_view_iterator_tag; @@ -40,11 +45,13 @@ namespace boost { namespace fusion : view(in_view) {} SingleView& view; - - BOOST_DELETED_FUNCTION(single_view_iterator& operator=(single_view_iterator const&)) }; }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408 namespace std { diff --git a/include/boost/fusion/view/transform_view/transform_view.hpp b/include/boost/fusion/view/transform_view/transform_view.hpp index f0633018..901fe362 100644 --- a/include/boost/fusion/view/transform_view/transform_view.hpp +++ b/include/boost/fusion/view/transform_view/transform_view.hpp @@ -27,6 +27,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { struct void_; @@ -75,9 +80,6 @@ namespace boost { namespace fusion transform_type f; typename mpl::if_, Sequence1, Sequence1&>::type seq1; typename mpl::if_, Sequence2, Sequence2&>::type seq2; - - // silence MSVC warning C4512: assignment operator could not be generated - BOOST_DELETED_FUNCTION(transform_view& operator= (transform_view const&)) }; // Unary Version @@ -111,12 +113,13 @@ namespace boost { namespace fusion last_type last() const { return fusion::end(seq); } typename mpl::if_, Sequence, Sequence&>::type seq; transform_type f; - - // silence MSVC warning C4512: assignment operator could not be generated - BOOST_DELETED_FUNCTION(transform_view& operator= (transform_view const&)) }; }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #endif diff --git a/include/boost/fusion/view/transform_view/transform_view_iterator.hpp b/include/boost/fusion/view/transform_view/transform_view_iterator.hpp index 071cba8e..ba5b7c9b 100644 --- a/include/boost/fusion/view/transform_view/transform_view_iterator.hpp +++ b/include/boost/fusion/view/transform_view/transform_view_iterator.hpp @@ -23,6 +23,11 @@ #include #include +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif + namespace boost { namespace fusion { // Unary Version @@ -44,9 +49,6 @@ namespace boost { namespace fusion first_type first; transform_type f; - - // silence MSVC warning C4512: assignment operator could not be generated - BOOST_DELETED_FUNCTION(transform_view_iterator& operator= (transform_view_iterator const&)) }; // Binary Version @@ -71,12 +73,13 @@ namespace boost { namespace fusion first1_type first1; first2_type first2; transform_type f; - - // silence MSVC warning C4512: assignment operator could not be generated - BOOST_DELETED_FUNCTION(transform_view_iterator2& operator= (transform_view_iterator2 const&)) }; }} +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408 namespace std { diff --git a/test/sequence/segmented_iterator_range.cpp b/test/sequence/segmented_iterator_range.cpp index df49407a..236a7e27 100644 --- a/test/sequence/segmented_iterator_range.cpp +++ b/test/sequence/segmented_iterator_range.cpp @@ -21,6 +21,10 @@ #include #include "tree.hpp" +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated. +#endif struct ostream_fun { ostream_fun(std::ostream &sout) @@ -34,6 +38,9 @@ struct ostream_fun private: std::ostream & sout_; }; +#ifdef _MSC_VER +# pragma warning(pop) +#endif template void From ba320bf395c14175c1c82b8986babd124a2cc10f Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Fri, 9 Sep 2022 21:32:01 +0300 Subject: [PATCH 25/28] deref_data_impl.hpp: fix missing includes --- .../fusion/view/transform_view/detail/deref_data_impl.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/boost/fusion/view/transform_view/detail/deref_data_impl.hpp b/include/boost/fusion/view/transform_view/detail/deref_data_impl.hpp index 3eb325a4..83ea236a 100644 --- a/include/boost/fusion/view/transform_view/detail/deref_data_impl.hpp +++ b/include/boost/fusion/view/transform_view/detail/deref_data_impl.hpp @@ -10,6 +10,11 @@ #include #include #include +#include +#include +#include +#include +#include namespace boost { namespace fusion { From 51629ef53a52a2a89f8f4554fb432fb1a42e7cca Mon Sep 17 00:00:00 2001 From: djowel Date: Mon, 26 Sep 2022 08:12:29 +0800 Subject: [PATCH 26/28] Merge branch 'master' into develop From d8e3cc29da7b539a0c98995ffe738b99d54ab5f7 Mon Sep 17 00:00:00 2001 From: djowel Date: Mon, 26 Sep 2022 08:38:53 +0800 Subject: [PATCH 27/28] Merge branch 'master' into develop From 4c4d2ad66cbe7cbeb429397d88fa3ce48aa18429 Mon Sep 17 00:00:00 2001 From: djowel Date: Mon, 26 Sep 2022 08:59:02 +0800 Subject: [PATCH 28/28] Merge branch 'master' into develop --- .../boost/fusion/container/vector/vector.hpp | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/include/boost/fusion/container/vector/vector.hpp b/include/boost/fusion/container/vector/vector.hpp index f20e1de0..abe2d7bb 100644 --- a/include/boost/fusion/container/vector/vector.hpp +++ b/include/boost/fusion/container/vector/vector.hpp @@ -168,15 +168,9 @@ namespace boost { namespace fusion : elem(std::forward(rhs)) {} - using elem_type = T; T elem; }; - // placed outside of vector_data due to GCC < 6 bug - template - static inline BOOST_FUSION_GPU_ENABLED - store store_at_impl(store*); - template struct vector_data; @@ -228,23 +222,32 @@ namespace boost { namespace fusion #endif } - private: - template - using store_at = decltype(store_at_impl(static_cast(nullptr))); + template + static BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + U& at_detail(store* this_) + { + return this_->elem; + } + + template + static BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + U const& at_detail(store const* this_) + { + return this_->elem; + } - public: template BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED - typename store_at::elem_type& at_impl(J) + auto at_impl(J) -> decltype(at_detail(&std::declval())) { - return store_at::elem; + return at_detail(this); } template BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED - typename store_at::elem_type const& at_impl(J) const + auto at_impl(J) const -> decltype(at_detail(&std::declval())) { - return store_at::elem; + return at_detail(this); } }; } // namespace boost::fusion::vector_detail