-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pfr_extension] Implemented macro adapter
- Loading branch information
Showing
20 changed files
with
923 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,5 @@ target_link_libraries(boost_fusion | |
Boost::type_traits | ||
Boost::typeof | ||
Boost::utility | ||
Boost::pfr | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/*============================================================================= | ||
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) | ||
==============================================================================*/ | ||
|
||
#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/adapt_pfr.hpp> | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/*============================================================================= | ||
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_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/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/support/tag_of_fwd.hpp> | ||
|
||
#define BOOST_FUSION_ADAPT_PFR(NAME) \ | ||
\ | ||
namespace boost { namespace fusion { \ | ||
struct pfr_tag; \ | ||
struct fusion_sequence_tag; \ | ||
\ | ||
namespace traits \ | ||
{ \ | ||
template<> \ | ||
struct tag_of<NAME> \ | ||
{ \ | ||
using type = pfr_tag; \ | ||
}; \ | ||
template<> \ | ||
struct tag_of<NAME const> \ | ||
{ \ | ||
using type = pfr_tag; \ | ||
}; \ | ||
} \ | ||
}} \ | ||
\ | ||
namespace boost { namespace mpl \ | ||
{ \ | ||
template<typename> \ | ||
struct sequence_tag; \ | ||
\ | ||
template<> \ | ||
struct sequence_tag<NAME> \ | ||
{ \ | ||
using type = fusion::fusion_sequence_tag; \ | ||
}; \ | ||
\ | ||
template<> \ | ||
struct sequence_tag<NAME const> \ | ||
{ \ | ||
using type = fusion::fusion_sequence_tag; \ | ||
}; \ | ||
}} | ||
|
||
#define BOOST_FUSION_ADAPT_TPL_PFR(NAME) \ | ||
\ | ||
namespace boost { namespace fusion { \ | ||
struct pfr_tag; \ | ||
struct fusion_sequence_tag; \ | ||
\ | ||
namespace traits \ | ||
{ \ | ||
template<typename... Args> \ | ||
struct tag_of<NAME<Args...>> \ | ||
{ \ | ||
using type = pfr_tag; \ | ||
}; \ | ||
template<typename... Args> \ | ||
struct tag_of<NAME<Args...> const> \ | ||
{ \ | ||
using type = pfr_tag; \ | ||
}; \ | ||
} \ | ||
}} \ | ||
\ | ||
namespace boost { namespace mpl \ | ||
{ \ | ||
template<typename> \ | ||
struct sequence_tag; \ | ||
\ | ||
template<typename... Args> \ | ||
struct sequence_tag<NAME<Args...>> \ | ||
{ \ | ||
using type = fusion::fusion_sequence_tag; \ | ||
}; \ | ||
\ | ||
template<typename... Args> \ | ||
struct sequence_tag<NAME<Args...> const> \ | ||
{ \ | ||
using type = fusion::fusion_sequence_tag; \ | ||
}; \ | ||
}} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/*============================================================================= | ||
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_ADAPTED_PFR_DETAIL_AT_IMPL_HPP) | ||
#define BOOST_FUSION_ADAPTED_PFR_DETAIL_AT_IMPL_HPP | ||
|
||
#include <boost/fusion/support/config.hpp> | ||
#include <boost/fusion/view/pfr_fields_view.hpp> | ||
#include <boost/fusion/algorithm/auxiliary/pfr_fields.hpp> | ||
#include <boost/fusion/sequence/intrinsic/at.hpp> | ||
|
||
namespace boost { namespace fusion | ||
{ | ||
struct pfr_tag; | ||
|
||
namespace extension | ||
{ | ||
template<typename T> | ||
struct at_impl; | ||
|
||
template<> | ||
struct at_impl<pfr_tag> | ||
{ | ||
template <typename Aggregate, typename N> | ||
struct apply | ||
{ | ||
using type = typename result_of::at< pfr_fields_view<Aggregate>, N >::type; | ||
|
||
constexpr BOOST_FUSION_GPU_ENABLED | ||
static type | ||
call(Aggregate& seq) | ||
{ | ||
return at<N>(pfr_fields(seq)); | ||
} | ||
}; | ||
}; | ||
} | ||
}} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/*============================================================================= | ||
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_ADAPTED_PFR_DETAIL_BEGIN_IMPL_HPP) | ||
#define BOOST_FUSION_ADAPTED_PFR_DETAIL_BEGIN_IMPL_HPP | ||
|
||
#include <boost/fusion/support/config.hpp> | ||
#include <boost/fusion/view/pfr_fields_view.hpp> | ||
#include <boost/fusion/algorithm/auxiliary/pfr_fields.hpp> | ||
#include <boost/fusion/sequence/intrinsic/begin.hpp> | ||
|
||
namespace boost { namespace fusion | ||
{ | ||
struct pfr_tag; | ||
|
||
namespace extension | ||
{ | ||
template<typename T> | ||
struct begin_impl; | ||
|
||
template <> | ||
struct begin_impl<pfr_tag> | ||
{ | ||
template <typename Aggregate> | ||
struct apply | ||
{ | ||
using type = typename result_of::begin< pfr_fields_view<Aggregate> >::type; | ||
|
||
constexpr BOOST_FUSION_GPU_ENABLED | ||
static type | ||
call(Aggregate& seq) | ||
{ | ||
return begin(pfr_fields(seq)); | ||
} | ||
}; | ||
}; | ||
} | ||
}} | ||
|
||
#endif |
34 changes: 34 additions & 0 deletions
34
include/boost/fusion/adapted/pfr/detail/category_of_impl.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/*============================================================================= | ||
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_ADAPTED_PFR_DETAIL_CATEGORY_OF_IMPL_HPP) | ||
#define BOOST_FUSION_ADAPTED_PFR_DETAIL_CATEGORY_OF_IMPL_HPP | ||
|
||
#include <boost/fusion/support/config.hpp> | ||
|
||
namespace boost { namespace fusion | ||
{ | ||
struct pfr_tag; | ||
struct random_access_traversal_tag; | ||
|
||
namespace extension | ||
{ | ||
template<typename T> | ||
struct category_of_impl; | ||
|
||
template<> | ||
struct category_of_impl<pfr_tag> | ||
{ | ||
template<typename T> | ||
struct apply | ||
{ | ||
using type = random_access_traversal_tag; | ||
}; | ||
}; | ||
} | ||
}} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/*============================================================================= | ||
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_ADAPTED_PFR_DETAIL_END_IMPL_HPP) | ||
#define BOOST_FUSION_ADAPTED_PFR_DETAIL_END_IMPL_HPP | ||
|
||
#include <boost/fusion/support/config.hpp> | ||
#include <boost/fusion/view/pfr_fields_view.hpp> | ||
#include <boost/fusion/algorithm/auxiliary/pfr_fields.hpp> | ||
#include <boost/fusion/sequence/intrinsic/end.hpp> | ||
|
||
namespace boost { namespace fusion | ||
{ | ||
struct pfr_tag; | ||
|
||
namespace extension | ||
{ | ||
template<typename T> | ||
struct end_impl; | ||
|
||
template<> | ||
struct end_impl<pfr_tag> | ||
{ | ||
template <typename Aggregate> | ||
struct apply | ||
{ | ||
using type = typename result_of::end< pfr_fields_view<Aggregate> >::type; | ||
|
||
constexpr BOOST_FUSION_GPU_ENABLED | ||
static type | ||
call(Aggregate& seq) | ||
{ | ||
return end(pfr_fields(seq)); | ||
} | ||
}; | ||
}; | ||
} | ||
}} | ||
|
||
#endif |
31 changes: 31 additions & 0 deletions
31
include/boost/fusion/adapted/pfr/detail/is_sequence_impl.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/*============================================================================= | ||
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_ADAPTED_PFR_DETAIL_IS_SEQUENCE_IMPL_HPP) | ||
#define BOOST_FUSION_ADAPTED_PFR_DETAIL_IS_SEQUENCE_IMPL_HPP | ||
|
||
#include <boost/fusion/support/config.hpp> | ||
#include <boost/mpl/bool.hpp> | ||
|
||
namespace boost { namespace fusion | ||
{ | ||
struct pfr_tag; | ||
|
||
namespace extension | ||
{ | ||
template<typename Tag> | ||
struct is_sequence_impl; | ||
|
||
template<> | ||
struct is_sequence_impl<pfr_tag> | ||
{ | ||
template<typename Aggregate> | ||
struct apply : mpl::true_ {}; | ||
}; | ||
} | ||
}} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/*============================================================================= | ||
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_ADAPTED_PFR_DETAIL_IS_VIEW_IMPL_HPP) | ||
#define BOOST_FUSION_ADAPTED_PFR_DETAIL_IS_VIEW_IMPL_HPP | ||
|
||
#include <boost/fusion/support/config.hpp> | ||
#include <boost/mpl/bool.hpp> | ||
|
||
namespace boost { namespace fusion | ||
{ | ||
struct pfr_tag; | ||
|
||
namespace extension | ||
{ | ||
template<typename Tag> | ||
struct is_view_impl; | ||
|
||
template<> | ||
struct is_view_impl<pfr_tag> | ||
{ | ||
template<typename T> | ||
struct apply : mpl::false_ {}; | ||
}; | ||
} | ||
}} | ||
|
||
#endif |
Oops, something went wrong.