From 3f6f947233da26794b6a41d120533505a3be1909 Mon Sep 17 00:00:00 2001 From: Joel de Guzman Date: Fri, 15 Jul 2022 09:56:21 +0800 Subject: [PATCH 01/21] Revert "Added functional dependency to master" --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9dd1d3ee..707b4f89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,5 +23,4 @@ target_link_libraries(boost_fusion Boost::type_traits Boost::typeof Boost::utility - Boost::functional ) From dd3bf8aa3e09cc527f924f1095ff4782ad000338 Mon Sep 17 00:00:00 2001 From: djowel Date: Mon, 26 Sep 2022 08:11:49 +0800 Subject: [PATCH 02/21] Merge branch 'develop' --- CMakeLists.txt | 1 + .../boost/fusion/container/vector/vector.hpp | 31 +++++++++---------- 2 files changed, 15 insertions(+), 17 deletions(-) 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 ) diff --git a/include/boost/fusion/container/vector/vector.hpp b/include/boost/fusion/container/vector/vector.hpp index abe2d7bb..f20e1de0 100644 --- a/include/boost/fusion/container/vector/vector.hpp +++ b/include/boost/fusion/container/vector/vector.hpp @@ -168,9 +168,15 @@ 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; @@ -222,32 +228,23 @@ namespace boost { namespace fusion #endif } - 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; - } + private: + template + using store_at = decltype(store_at_impl(static_cast(nullptr))); + public: template BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED - auto at_impl(J) -> decltype(at_detail(&std::declval())) + typename store_at::elem_type& at_impl(J) { - return at_detail(this); + return store_at::elem; } template BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED - auto at_impl(J) const -> decltype(at_detail(&std::declval())) + typename store_at::elem_type const& at_impl(J) const { - return at_detail(this); + return store_at::elem; } }; } // namespace boost::fusion::vector_detail From 95b6ebdc61b9a44f894a98b9a35e23b6fab4fbd1 Mon Sep 17 00:00:00 2001 From: djowel Date: Mon, 26 Sep 2022 08:38:01 +0800 Subject: [PATCH 03/21] Merge branch 'develop' From 0c6c0b17e51ed4607046e0aa68ff2a3ecb759cf3 Mon Sep 17 00:00:00 2001 From: Denis Mikhailov Date: Sun, 7 Nov 2021 03:03:18 +0400 Subject: [PATCH 04/21] Update reverse_view.cpp --- test/sequence/reverse_view.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/test/sequence/reverse_view.cpp b/test/sequence/reverse_view.cpp index 356b9b0b..4e6688f5 100644 --- a/test/sequence/reverse_view.cpp +++ b/test/sequence/reverse_view.cpp @@ -1,6 +1,5 @@ /*============================================================================= Copyright (c) 2001-2011 Joel de Guzman - 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) @@ -16,9 +15,6 @@ #include #include #include -#include -#include -#include #include #include #include @@ -119,7 +115,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 24138813d64ae35900b13cf0c9496884b5813a40 Mon Sep 17 00:00:00 2001 From: Denis Mikhailov Date: Sun, 7 Nov 2021 03:29:06 +0400 Subject: [PATCH 05/21] 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 e15016adb6df0be829a238802bead45e8843f531 Mon Sep 17 00:00:00 2001 From: denzor200 Date: Sun, 7 Nov 2021 23:07:18 +0400 Subject: [PATCH 06/21] Applied fixes for reverse_view --- .../reverse_view/detail/deref_data_impl.hpp | 27 +++---------------- .../view/reverse_view/detail/key_of_impl.hpp | 2 +- .../detail/value_of_data_impl.hpp | 15 +++-------- test/sequence/reverse_view.cpp | 1 + 4 files changed, 10 insertions(+), 35 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 db64d32b..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,6 +1,6 @@ /*============================================================================= Copyright (c) 2009 Christopher Schmidt - Copyright (c) 2021-2022 Denis Mikhailov + 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,8 +10,7 @@ #define BOOST_FUSION_VIEW_REVERSE_VIEW_DETAIL_DEREF_DATA_IMPL_HPP #include -#include -#include +#include namespace boost { namespace fusion { namespace extension { @@ -20,26 +19,8 @@ namespace boost { namespace fusion { namespace extension template <> struct deref_data_impl - { - template - struct apply - { - typedef typename - result_of::deref_data< - typename result_of::prior< - typename It::first_type - >::type - >::type - type; - - BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED - static type - call(It const& it) - { - return fusion::deref_data(fusion::prior(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 0b8fc3bc..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,6 +1,6 @@ /*============================================================================= Copyright (c) 2009 Christopher Schmidt - Copyright (c) 2021-2022 Denis Mikhailov + 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) 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 03cb753f..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,6 +1,6 @@ /*============================================================================= Copyright (c) 2009 Christopher Schmidt - Copyright (c) 2021-2022 Denis Mikhailov + 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) @@ -11,7 +11,7 @@ #include #include -#include +#include namespace boost { namespace fusion { namespace extension { @@ -23,15 +23,8 @@ namespace boost { namespace fusion { namespace extension { template struct apply - { - typedef typename - result_of::value_of_data< - typename result_of::prior< - typename It::first_type - >::type - >::type - type; - }; + : 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 d49b59bdf9fa58d22281a1e1d5e64ef672ba97d4 Mon Sep 17 00:00:00 2001 From: denzor200 Date: Mon, 8 Nov 2021 02:11:31 +0400 Subject: [PATCH 07/21] 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 60408efa18571abaf2f2cdb45be7e82cbc133477 Mon Sep 17 00:00:00 2001 From: Denis Mikhailov Date: Sun, 9 Jan 2022 07:45:54 +0400 Subject: [PATCH 08/21] Update view.qbk --- doc/view.qbk | 58 ---------------------------------------------------- 1 file changed, 58 deletions(-) diff --git a/doc/view.qbk b/doc/view.qbk index a3ad4d09..e65ac630 100644 --- a/doc/view.qbk +++ b/doc/view.qbk @@ -1,7 +1,6 @@ [/============================================================================== 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 @@ -364,7 +363,6 @@ 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]] @@ -665,60 +663,4 @@ 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] From 2a70da0170146c98caa015e77815b95f52919af0 Mon Sep 17 00:00:00 2001 From: Denis Mikhailov Date: Fri, 5 Nov 2021 14:13:09 +0400 Subject: [PATCH 09/21] Update appveyor.yml --- appveyor.yml | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index debd336b..cc1d3dce 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,21 +10,8 @@ shallow_clone: true environment: matrix: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - TOOLSET: msvc-9.0 + TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0,msvc-12.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 @@ -92,5 +79,4 @@ install: build: off test_script: - - if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD% - - b2 -j%NUMBER_OF_PROCESSORS% --hash libs/fusion/test toolset=%TOOLSET% cxxstd=%CXXSTD% %ADDRMD% + - b2 -j%NUMBER_OF_PROCESSORS% --hash libs/fusion/test toolset=%TOOLSET% cxxstd=%CXXSTD% From df3766850106c8d082fb53109b4123b75c684e2b Mon Sep 17 00:00:00 2001 From: Denis Mikhailov Date: Fri, 5 Nov 2021 14:51:22 +0400 Subject: [PATCH 10/21] 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 116768f3b2c840a74e639e31299973f2996da928 Mon Sep 17 00:00:00 2001 From: Denis Mikhailov Date: Fri, 5 Nov 2021 15:39:10 +0400 Subject: [PATCH 11/21] 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 3a98d9dbebdc61db211e74e858f85e750c73d451 Mon Sep 17 00:00:00 2001 From: denzor200 Date: Sat, 6 Nov 2021 20:09:19 +0400 Subject: [PATCH 12/21] [transform_view_ext] Updated docs --- doc/sequence.qbk | 4 ---- doc/view.qbk | 7 ++++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/doc/sequence.qbk b/doc/sequence.qbk index 554d951f..b193b8e9 100644 --- a/doc/sequence.qbk +++ b/doc/sequence.qbk @@ -133,7 +133,6 @@ For any Forward Sequence s the following invariants always hold: * __transform_view__ * __reverse_view__ * __zip_view__ -* __identity_view__ [endsect] @@ -202,7 +201,6 @@ 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] @@ -291,7 +289,6 @@ 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] @@ -364,7 +361,6 @@ 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 e65ac630..6caa33fc 100644 --- a/doc/view.qbk +++ b/doc/view.qbk @@ -360,9 +360,10 @@ given a binary function object or function pointer. [heading Model of] -* __forward_sequence__, __bidirectional_sequence__ or -__random_access_sequence__ depending on the traversal characteristics (see -__traversal_concept__) of its underlying sequence or sequences. +* 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]] From c4e7f2bb1a5fda90a4e77d0048369ee3939e240b Mon Sep 17 00:00:00 2001 From: denzor200 Date: Sun, 9 Jan 2022 16:34:07 +0400 Subject: [PATCH 13/21] [transform_view_ext] Unary transform_view is an Associative Sequence now --- doc/view.qbk | 8 ++++---- .../transform_view/detail/deref_data_impl.hpp | 5 ----- .../transform_view/transform_view_iterator.hpp | 15 ++++++--------- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/doc/view.qbk b/doc/view.qbk index 6caa33fc..d99b325f 100644 --- a/doc/view.qbk +++ b/doc/view.qbk @@ -360,10 +360,10 @@ given a binary function object or function pointer. [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. +* __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 index 83ea236a..3eb325a4 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,11 +10,6 @@ #include #include #include -#include -#include -#include -#include -#include namespace boost { namespace fusion { 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 ba5b7c9b..071cba8e 100644 --- a/include/boost/fusion/view/transform_view/transform_view_iterator.hpp +++ b/include/boost/fusion/view/transform_view/transform_view_iterator.hpp @@ -23,11 +23,6 @@ #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 @@ -49,6 +44,9 @@ 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 @@ -73,13 +71,12 @@ 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 { From aca00012d152a56e8ec398e488241f7a0a06c409 Mon Sep 17 00:00:00 2001 From: denzor200 Date: Mon, 10 Jan 2022 21:19:38 +0400 Subject: [PATCH 14/21] [identity_view] Added boost::fusion::identity_view --- doc/sequence.qbk | 4 ++ doc/view.qbk | 57 +++++++++++++++++++ .../view/identity_view/identity_view.hpp | 31 ++-------- test/sequence/identity_view.cpp | 19 ++----- 4 files changed, 70 insertions(+), 41 deletions(-) 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/view/identity_view/identity_view.hpp b/include/boost/fusion/view/identity_view/identity_view.hpp index 4cd0c093..f26f2bc7 100644 --- a/include/boost/fusion/view/identity_view/identity_view.hpp +++ b/include/boost/fusion/view/identity_view/identity_view.hpp @@ -10,41 +10,18 @@ #include #include #include -#include -namespace boost { namespace fusion { - namespace detail { - struct identity : boost::identity - { - }; - } -}} - -namespace boost { - template - struct result_of - { - typedef T type; - }; -} - -#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 + : 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, detail::identity()) {} + : base_type(in_seq, boost::identity()) {} }; + }} -#ifdef _MSC_VER -# pragma warning(pop) -#endif #endif diff --git a/test/sequence/identity_view.cpp b/test/sequence/identity_view.cpp index e74f9294..285b17e2 100644 --- a/test/sequence/identity_view.cpp +++ b/test/sequence/identity_view.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include @@ -77,16 +76,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 >)); - } - - { - 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))); + BOOST_MPL_ASSERT((boost::is_same::type, boost::mpl::integral_c&& >)); } /// Associative @@ -153,9 +143,10 @@ main() 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 >)); + // 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&& >)); } { From 2a9a44ee7c2013823f3f09d32a2d4e54fa183f34 Mon Sep 17 00:00:00 2001 From: Denis Mikhailov Date: Wed, 12 Jan 2022 09:48:26 +0400 Subject: [PATCH 15/21] 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 622e048cf2d74b9577b1586a1da21598d24dfd9d Mon Sep 17 00:00:00 2001 From: Denis Mikhailov Date: Wed, 12 Jan 2022 10:14:07 +0400 Subject: [PATCH 16/21] 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 efe3d59c734009b84e9e7353435cac436031f44d Mon Sep 17 00:00:00 2001 From: denzor200 Date: Sat, 15 Jan 2022 22:22:46 +0400 Subject: [PATCH 17/21] [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 b13fc27cf21bc5c42322b83ba7586dd7234c1bb3 Mon Sep 17 00:00:00 2001 From: denzor200 Date: Sun, 16 Jan 2022 09:49:05 +0400 Subject: [PATCH 18/21] 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 72c5c094b973e9a35f785092bfa5a5476f2a4365 Mon Sep 17 00:00:00 2001 From: denzor200 Date: Mon, 24 Jan 2022 23:40:18 +0400 Subject: [PATCH 19/21] [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 8d8db27953c5b90280a85e290dcaf32b9ea49ebb Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Sun, 16 Jan 2022 22:52:11 +0300 Subject: [PATCH 20/21] Fix Clang 13 `-Wdeprecated-copy` warnings Clang 13 have new warning under the same group --- .../fusion/view/identity_view/identity_view.hpp | 7 +++++++ .../transform_view/transform_view_iterator.hpp | 15 +++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) 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/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 { From a8847092537edc38dcf28704076ae3b8cd2cc20c Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Fri, 9 Sep 2022 21:32:01 +0300 Subject: [PATCH 21/21] 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 {