Compare commits

...

8 Commits

Author SHA1 Message Date
53da4e0b2c Fix include guard in adapt_assoc_adt.hpp (#273) 2024-05-15 17:13:08 +08:00
7d4c03fa03 Don't include std stream headers ourselves (#270) 2023-03-18 16:31:22 +08:00
5d19cc2d57 Remove template arguments redefinition workaround for VS2022 update 5. (#268)
Update 5 adds /Zc:templateScope flag which causes compile errors in
typedefs redefining template parameters.
2023-02-28 07:29:50 +08:00
049303436c Old permissions restored (#265) 2023-02-25 16:45:19 +08:00
8c32ebea0b Removed executable flags from files. (#267) 2023-02-21 08:35:45 +08:00
3044c2beaf missing make_pair() for r-value refs (#264)
* missing make_pair() for r-value refs

hello guys!

the `make_pair()` for r-value refs is required for r-value, otherwise `non-copyable` but `movable` can be constructed.


thanks!

* fix for prev commit

conditional support for r-values was fixed

* the test case was added

* fix for prev commit

* Update Jamfile

* one more fix for Jamfile

* the forgotten r-value ctor was added

* ah, they should be conditional
2023-02-11 10:10:25 +08:00
d6298309fb Implemented ability to set fallback for tag_of (#263) 2022-12-22 08:16:10 +08:00
0a2da9d0ac Add describe dependency (#262)
* Add describe dependency

* Add mp11 dependency
2022-12-21 13:49:11 +08:00
15 changed files with 115 additions and 14 deletions

View File

@ -344,6 +344,8 @@ jobs:
git submodule init libs/type_traits
git submodule init libs/typeof
git submodule init libs/utility
git submodule init libs/describe
git submodule init libs/mp11
git submodule init libs/headers tools/boost_install tools/build
git submodule update
rm -rf libs/fusion
@ -452,6 +454,8 @@ jobs:
git submodule init libs/type_traits
git submodule init libs/typeof
git submodule init libs/utility
git submodule init libs/describe
git submodule init libs/mp11
git submodule init libs/headers tools/boost_install tools/build
git submodule update
rm -rf libs/fusion
@ -464,4 +468,4 @@ jobs:
./b2 -j`(nproc || sysctl -n hw.ncpu) 2> /dev/null` libs/fusion/test toolset=$TOOLSET cxxstd=$CXXSTD
fi
fi

View File

@ -24,4 +24,6 @@ target_link_libraries(boost_fusion
Boost::typeof
Boost::utility
Boost::functional
Boost::describe
Boost::mp11
)

View File

@ -82,6 +82,8 @@ install:
- git submodule init libs/type_traits
- git submodule init libs/typeof
- git submodule init libs/utility
- git submodule init libs/describe
- git submodule init libs/mp11
- git submodule init libs/headers tools/boost_install tools/build
- git submodule update

View File

@ -143,7 +143,7 @@
I, \
ATTRIBUTE)
#ifdef BOOST_MSVC
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1935)
# define BOOST_FUSION_ADAPT_STRUCT_MSVC_REDEFINE_TEMPLATE_PARAM(R,_,ELEM) \
typedef ELEM ELEM;
# define BOOST_FUSION_ADAPT_STRUCT_MSVC_REDEFINE_TEMPLATE_PARAMS_IMPL(SEQ) \

View File

@ -6,7 +6,7 @@
==============================================================================*/
#ifndef BOOST_FUSION_INCLUDE_ADAPT_ASSOC_ADT_HPP
#define BOOST_FUSION_INCLUDE_ADAPT_ASSOC_ADR_HPP
#define BOOST_FUSION_INCLUDE_ADAPT_ASSOC_ADT_HPP
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/adapted/adt/adapt_assoc_adt.hpp>

View File

@ -10,7 +10,6 @@
#define FUSION_IN_05052005_0121
#include <boost/fusion/support/config.hpp>
#include <istream>
#include <boost/fusion/sequence/io/detail/manip.hpp>
#include <boost/mpl/bool.hpp>

View File

@ -36,10 +36,10 @@ namespace boost { namespace fusion
namespace detail
{
template <typename Tag>
int get_xalloc_index(Tag* = 0)
int get_xalloc_index(int xalloc())
{
// each Tag will have a unique index
static int index = std::ios::xalloc();
static int const index = xalloc();
return index;
}
@ -66,12 +66,12 @@ namespace boost { namespace fusion
{
static arena ar; // our arena
ar.data.push_back(new T(data));
stream.pword(get_xalloc_index<Tag>()) = ar.data.back();
stream.pword(get_xalloc_index<Tag>(stream.xalloc)) = ar.data.back();
}
static T const* get(Stream& stream)
{
return (T const*)stream.pword(get_xalloc_index<Tag>());
return (T const*)stream.pword(get_xalloc_index<Tag>(stream.xalloc));
}
};
@ -114,7 +114,6 @@ namespace boost { namespace fusion
{
// read a delimiter
string_type const* p = stream_data_t::get(stream);
std::ws(stream);
if (p)
{
@ -141,7 +140,7 @@ namespace boost { namespace fusion
if (stream.get() != c)
{
stream.unget();
stream.setstate(std::ios::failbit);
stream.setstate(Stream::failbit);
}
}
}

View File

@ -10,7 +10,6 @@
#define FUSION_OUT_05052005_0121
#include <boost/fusion/support/config.hpp>
#include <ostream>
#include <boost/fusion/sequence/io/detail/manip.hpp>
#include <boost/mpl/bool.hpp>

View File

@ -10,9 +10,9 @@
#define BOOST_IN_05042005_0120
#include <boost/fusion/support/config.hpp>
#include <istream>
#include <boost/fusion/sequence/io/detail/in.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <iosfwd>
namespace boost { namespace fusion
{

View File

@ -10,11 +10,11 @@
#define BOOST_OUT_05042005_0120
#include <boost/fusion/support/config.hpp>
#include <ostream>
#include <boost/fusion/sequence/io/detail/out.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/mpl/or.hpp>
#include <iosfwd>
namespace boost { namespace fusion
{

View File

@ -120,6 +120,17 @@ namespace boost { namespace fusion
return pair<First, typename detail::as_fusion_element<Second>::type>(val);
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <typename First, typename Second>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::make_pair<First,Second>::type
make_pair(Second&& val)
{
return pair<First, typename detail::as_fusion_element<Second>::type>(
BOOST_FUSION_FWD_ELEM(Second, val));
}
#endif
template <typename First, typename Second>
inline std::ostream&
operator<<(std::ostream& os, pair<First, Second> const& p)

View File

@ -48,11 +48,17 @@ namespace boost { namespace fusion
{
BOOST_MPL_HAS_XXX_TRAIT_DEF(fusion_tag)
template<typename Sequence, typename Active=void>
struct tag_of_fallback
{
typedef non_fusion_tag type;
};
template <typename Sequence, typename Active>
struct tag_of_impl
: mpl::if_<fusion::detail::is_mpl_sequence<Sequence>,
mpl::identity<mpl_sequence_tag>,
mpl::identity<non_fusion_tag> >::type
mpl::identity<typename tag_of_fallback<Sequence>::type> >::type
{};
template <typename Sequence>

View File

@ -271,6 +271,11 @@ project
: [ requires cxx11_variadic_templates ] ]
[ compile support/tag_of.cpp ]
[ compile support/unused.cpp ]
[ compile support/detail/tag_of_fallback.cpp ]
[ compile-fail support/make_pair_r-value.cpp ]
[ compile support/make_pair_r-value.cpp
: [ requires cxx11_rvalue_references ] ]
# [ compile-fail xxx.cpp ]

View File

@ -0,0 +1,50 @@
/*=============================================================================
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 <boost/fusion/support/tag_of.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/core/enable_if.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
namespace mpl = boost::mpl;
template<typename T>
struct my_is_implicitly_reflectable;
namespace boost { namespace fusion
{
struct boost_my_reflectable_tag;
namespace detail
{
template<typename Sequence>
struct tag_of_fallback<Sequence, typename boost::enable_if<boost::is_same<Sequence, Sequence> >::type>
{
typedef typename mpl::if_<my_is_implicitly_reflectable<Sequence>
, boost_my_reflectable_tag
, non_fusion_tag
>::type type;
};
}
}}
struct reflectable {};
struct non_reflectable {};
template<typename T>
struct my_is_implicitly_reflectable : mpl::false_ {};
template<>
struct my_is_implicitly_reflectable<reflectable> : mpl::true_ {};
typedef boost::fusion::traits::tag_of<reflectable>::type ReflectableTag;
typedef boost::fusion::traits::tag_of<non_reflectable>::type NonReflectableTag;
BOOST_STATIC_ASSERT((boost::is_same<ReflectableTag, boost::fusion::boost_my_reflectable_tag>::value));
BOOST_STATIC_ASSERT((boost::is_same<NonReflectableTag, boost::fusion::non_fusion_tag>::value));
int
main() { }

View File

@ -0,0 +1,24 @@
/*=============================================================================
Copyright (c) 2022 niXman (github dot nixman at pm.me)
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 <boost/fusion/support/pair.hpp>
struct noncopyable_type {
noncopyable_type(const noncopyable_type &) = delete;
noncopyable_type& operator=(const noncopyable_type &) = delete;
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
noncopyable_type(noncopyable_type &&) = default;
noncopyable_type& operaotr=(noncopyable_type &&) = default;
#endif
};
int main() {
using namespace boost::fusion;
pair<int, noncopyable_type> val = make_pair<int>(noncopyable_type{});
return 0;
}