Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,55 +123,55 @@ matrix:

- os: linux
dist: xenial
env: TOOLSET=clang-3.5 CXXSTD=03,11,14,1z
env: TOOLSET=clang-3.5 CXXSTD=03,11,14,1z CXXFLAGS="-DBOOST_PFR_USE_CPP17=0"
addons:
apt:
packages:
- clang-3.5

- os: linux
dist: xenial
env: TOOLSET=clang-3.6 CXXSTD=03,11,14,1z
env: TOOLSET=clang-3.6 CXXSTD=03,11,14,1z CXXFLAGS="-DBOOST_PFR_USE_CPP17=0"
addons:
apt:
packages:
- clang-3.6

- os: linux
dist: xenial
env: TOOLSET=clang-3.7 CXXSTD=03,11,14,1z
env: TOOLSET=clang-3.7 CXXSTD=03,11,14,1z CXXFLAGS="-DBOOST_PFR_USE_CPP17=0"
addons:
apt:
packages:
- clang-3.7

- os: linux
dist: xenial
env: TOOLSET=clang-3.8 CXXSTD=03,11,14,1z
env: TOOLSET=clang-3.8 CXXSTD=03,11,14,1z CXXFLAGS="-DBOOST_PFR_USE_CPP17=0"
addons:
apt:
packages:
- clang-3.8

- os: linux
dist: xenial
env: TOOLSET=clang-3.9 CXXSTD=03,11,14,1z
env: TOOLSET=clang-3.9 CXXSTD=03,11,14,1z CXXFLAGS="-DBOOST_PFR_USE_CPP17=0"
addons:
apt:
packages:
- clang-3.9

- os: linux
dist: xenial
env: TOOLSET=clang-4.0 CXXSTD=03,11,14,1z
env: TOOLSET=clang-4.0 CXXSTD=03,11,14,1z CXXFLAGS="-DBOOST_PFR_USE_CPP17=0"
addons:
apt:
packages:
- clang-4.0

- os: linux
dist: xenial
env: TOOLSET=clang-5.0 CXXSTD=03,11,14,17,2a
env: TOOLSET=clang-5.0 CXXSTD=03,11,14,17,2a CXXFLAGS="-DBOOST_PFR_USE_CPP17=0"
addons:
apt:
packages:
Expand All @@ -181,7 +181,7 @@ matrix:

- os: linux
dist: xenial
env: TOOLSET=clang-6.0 CXXSTD=03,11,14,17,2a
env: TOOLSET=clang-6.0 CXXSTD=03,11,14,17,2a CXXFLAGS="-DBOOST_PFR_USE_CPP17=0"
addons:
apt:
packages:
Expand All @@ -191,7 +191,7 @@ matrix:

- os: linux
dist: xenial
env: TOOLSET=clang-7.0 CXXSTD=03,11,14,17,2a
env: TOOLSET=clang-7.0 CXXSTD=03,11,14,17,2a CXXFLAGS="-DBOOST_PFR_USE_CPP17=0"
addons:
apt:
packages:
Expand All @@ -200,7 +200,7 @@ matrix:
- llvm-toolchain-xenial-7

- os: osx
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z CXXFLAGS="-DBOOST_PFR_USE_CPP17=0"

install:
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
Expand Down Expand Up @@ -236,6 +236,7 @@ install:
- git submodule init libs/type_traits
- git submodule init libs/typeof
- git submodule init libs/utility
- git submodule init libs/pfr

- git submodule init libs/headers tools/boost_install tools/build
- git submodule update
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ target_link_libraries(boost_fusion
Boost::type_traits
Boost::typeof
Boost::utility
Boost::pfr
)
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ install:
- git submodule init libs/type_traits
- git submodule init libs/typeof
- git submodule init libs/utility
- git submodule init libs/pfr

- git submodule init libs/headers tools/boost_install tools/build
- git submodule update
Expand Down
8 changes: 8 additions & 0 deletions include/boost/fusion/adapted.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,12 @@
#include <boost/fusion/adapted/std_tuple.hpp>
#endif

// Unfortunately, there is no way to determine the compatibility of the pfr library with the current compiler.
// The "boost/fusion/adapted/pfr.hpp" include has been commented out to ensure backward compatibility
// Please include it manually in your project

// #if !defined(BOOST_FUSION_NO_PFR)
// #include <boost/fusion/adapted/pfr.hpp>
// #endif

#endif
23 changes: 23 additions & 0 deletions include/boost/fusion/adapted/pfr.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*=============================================================================
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)
==============================================================================*/

#ifndef BOOST_FUSION_ADAPTED_PFR_HPP
#define BOOST_FUSION_ADAPTED_PFR_HPP

#include <boost/fusion/support/config.hpp>
#include <boost/fusion/adapted/pfr/detail/at_impl.hpp>
#include <boost/fusion/adapted/pfr/detail/begin_impl.hpp>
#include <boost/fusion/adapted/pfr/detail/category_of_impl.hpp>
#include <boost/fusion/adapted/pfr/detail/end_impl.hpp>
#include <boost/fusion/adapted/pfr/detail/is_sequence_impl.hpp>
#include <boost/fusion/adapted/pfr/detail/is_view_impl.hpp>
#include <boost/fusion/adapted/pfr/detail/size_impl.hpp>
#include <boost/fusion/adapted/pfr/detail/value_at_impl.hpp>
#include <boost/fusion/adapted/pfr/pfr_iterator.hpp>
#include <boost/fusion/adapted/pfr/adapt_pfr.hpp>

#endif //BOOST_FUSION_ADAPTED_PFR_HPP
34 changes: 34 additions & 0 deletions include/boost/fusion/adapted/pfr/adapt_pfr.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*=============================================================================
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)
==============================================================================*/

#ifndef BOOST_FUSION_ADAPTED_STRUCT_ADAPT_PFR_HPP
#define BOOST_FUSION_ADAPTED_STRUCT_ADAPT_PFR_HPP

#include <boost/fusion/support/config.hpp>
#include <boost/fusion/adapted/pfr/detail/adapt_base.hpp>
#include <boost/fusion/adapted/pfr/detail/at_impl.hpp>
#include <boost/fusion/adapted/pfr/detail/begin_impl.hpp>
#include <boost/fusion/adapted/pfr/detail/category_of_impl.hpp>
#include <boost/fusion/adapted/pfr/detail/end_impl.hpp>
#include <boost/fusion/adapted/pfr/detail/is_sequence_impl.hpp>
#include <boost/fusion/adapted/pfr/detail/is_view_impl.hpp>
#include <boost/fusion/adapted/pfr/detail/size_impl.hpp>
#include <boost/fusion/adapted/pfr/detail/value_at_impl.hpp>

#define BOOST_FUSION_ADAPT_TPL_PFR(TEMPLATE_PARAMS_SEQ,NAME_SEQ) \
BOOST_FUSION_ADAPT_PFR_BASE( \
(1)TEMPLATE_PARAMS_SEQ, \
(1)NAME_SEQ, \
pfr_tag)

#define BOOST_FUSION_ADAPT_PFR(NAME) \
BOOST_FUSION_ADAPT_PFR_BASE( \
(0), \
(0)(NAME), \
pfr_tag)

#endif //BOOST_FUSION_ADAPTED_STRUCT_ADAPT_PFR_HPP
134 changes: 134 additions & 0 deletions include/boost/fusion/adapted/pfr/detail/adapt_base.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/*=============================================================================
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)
==============================================================================*/

#ifndef BOOST_FUSION_ADAPTED_PFR_DETAIL_ADAPT_BASE_HPP
#define BOOST_FUSION_ADAPTED_PFR_DETAIL_ADAPT_BASE_HPP

#include <boost/fusion/support/config.hpp>
#include <boost/config.hpp>
#include <boost/fusion/support/tag_of_fwd.hpp>

#include <boost/preprocessor/empty.hpp>
#include <boost/preprocessor/stringize.hpp>
#include <boost/preprocessor/control/if.hpp>
#include <boost/preprocessor/seq/size.hpp>
#include <boost/preprocessor/seq/for_each.hpp>
#include <boost/preprocessor/seq/for_each_i.hpp>
#include <boost/preprocessor/seq/enum.hpp>
#include <boost/preprocessor/seq/seq.hpp>
#include <boost/preprocessor/tuple/eat.hpp>
#include <boost/preprocessor/tuple/elem.hpp>
#include <boost/preprocessor/arithmetic/dec.hpp>
#include <boost/preprocessor/comparison/less.hpp>
#include <boost/preprocessor/logical/not.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/tag.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>

#include <boost/typeof/typeof.hpp>

#define BOOST_FUSION_ADAPT_PFR_UNPACK_NAME_TEMPLATE_PARAMS(SEQ) \
BOOST_PP_SEQ_HEAD(SEQ)<BOOST_PP_SEQ_ENUM(BOOST_PP_SEQ_TAIL(SEQ))> \
BOOST_PP_EMPTY()

#define BOOST_FUSION_ADAPT_PFR_UNPACK_NAME(SEQ) \
BOOST_PP_IF( \
BOOST_PP_SEQ_HEAD(SEQ), \
BOOST_FUSION_ADAPT_PFR_UNPACK_NAME_TEMPLATE_PARAMS, \
BOOST_PP_SEQ_HEAD)(BOOST_PP_SEQ_TAIL(SEQ))

#define BOOST_FUSION_ADAPT_PFR_UNPACK_TEMPLATE_PARAMS_IMPL_C(R, _, ELEM) \
(typename ELEM)
#define BOOST_FUSION_ADAPT_PFR_UNPACK_TEMPLATE_PARAMS_IMPL(SEQ) \
BOOST_PP_SEQ_ENUM( \
BOOST_PP_SEQ_FOR_EACH( \
BOOST_FUSION_ADAPT_PFR_UNPACK_TEMPLATE_PARAMS_IMPL_C, \
_, \
BOOST_PP_SEQ_TAIL(SEQ)))
#define BOOST_FUSION_ADAPT_PFR_UNPACK_TEMPLATE_PARAMS(SEQ) \
BOOST_PP_IF( \
BOOST_PP_SEQ_HEAD(SEQ), \
BOOST_FUSION_ADAPT_PFR_UNPACK_TEMPLATE_PARAMS_IMPL, \
BOOST_PP_TUPLE_EAT(1))(SEQ)

#ifdef BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS
# define BOOST_FUSION_ADAPT_PFR_TAG_OF_SPECIALIZATION( \
MODIFIER, TEMPLATE_PARAMS_SEQ, NAME_SEQ, TAG) \
\
template< \
BOOST_FUSION_ADAPT_PFR_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \
> \
struct tag_of< \
BOOST_FUSION_ADAPT_PFR_UNPACK_NAME(NAME_SEQ) MODIFIER \
, void \
> \
{ \
typedef TAG type; \
};
#else
# define BOOST_FUSION_ADAPT_PFR_TAG_OF_SPECIALIZATION( \
MODIFIER, TEMPLATE_PARAMS_SEQ, NAME_SEQ, TAG) \
\
template< \
BOOST_FUSION_ADAPT_PFR_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \
> \
struct tag_of<BOOST_FUSION_ADAPT_PFR_UNPACK_NAME(NAME_SEQ) MODIFIER> \
{ \
typedef TAG type; \
};
#endif

#define BOOST_FUSION_ADAPT_PFR_BASE( \
TEMPLATE_PARAMS_SEQ, \
NAME_SEQ, \
TAG) \
\
namespace boost \
{ \
namespace fusion \
{ \
namespace traits \
{ \
BOOST_FUSION_ADAPT_PFR_TAG_OF_SPECIALIZATION( \
BOOST_PP_EMPTY(), TEMPLATE_PARAMS_SEQ, NAME_SEQ, TAG) \
BOOST_FUSION_ADAPT_PFR_TAG_OF_SPECIALIZATION( \
const, TEMPLATE_PARAMS_SEQ, NAME_SEQ, TAG) \
} \
} \
\
namespace mpl \
{ \
template<typename> \
struct sequence_tag; \
\
template< \
BOOST_FUSION_ADAPT_PFR_UNPACK_TEMPLATE_PARAMS( \
TEMPLATE_PARAMS_SEQ) \
> \
struct sequence_tag<BOOST_FUSION_ADAPT_PFR_UNPACK_NAME(NAME_SEQ)> \
{ \
typedef fusion::fusion_sequence_tag type; \
}; \
\
template< \
BOOST_FUSION_ADAPT_PFR_UNPACK_TEMPLATE_PARAMS( \
TEMPLATE_PARAMS_SEQ) \
> \
struct sequence_tag< \
BOOST_FUSION_ADAPT_PFR_UNPACK_NAME(NAME_SEQ) const \
> \
{ \
typedef fusion::fusion_sequence_tag type; \
}; \
} \
}

#endif //BOOST_FUSION_ADAPTED_PFR_DETAIL_ADAPT_BASE_HPP
56 changes: 56 additions & 0 deletions include/boost/fusion/adapted/pfr/detail/at_impl.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*=============================================================================
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)
==============================================================================*/

#ifndef BOOST_FUSION_ADAPTED_PFR_DETAIL_AT_IMPL_HPP
#define BOOST_FUSION_ADAPTED_PFR_DETAIL_AT_IMPL_HPP

#include <boost/fusion/support/config.hpp>
#include <boost/pfr/core.hpp>
#include <utility>
#include <boost/mpl/if.hpp>
#include <boost/fusion/support/detail/access.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/type_traits/is_const.hpp>

namespace boost { namespace fusion
{
struct pfr_tag;

namespace extension
{
template<typename T>
struct at_impl;

template<>
struct at_impl<pfr_tag>
{
template <typename Sequence, typename N>
struct apply
{
typedef typename remove_const<Sequence>::type seq_type;
typedef typename boost::pfr::tuple_element<N::value, seq_type>::type element;

typedef typename
mpl::if_<
is_const<Sequence>
, typename fusion::detail::cref_result<element>::type
, typename fusion::detail::ref_result<element>::type
>::type
type;

BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence& seq)
{
return boost::pfr::get<N::value>(seq);
}
};
};
}
}}

#endif //BOOST_FUSION_ADAPTED_PFR_DETAIL_AT_IMPL_HPP
Loading