forked from boostorg/fusion
gpu-enable functions
This commit is contained in:
committed by
Eric Niebler
parent
867c7e5dfb
commit
c4f9f0d1b6
@ -9,6 +9,7 @@
|
||||
#if !defined(FUSION_IN_05052005_0121)
|
||||
#define FUSION_IN_05052005_0121
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <istream>
|
||||
#include <boost/fusion/sequence/io/detail/manip.hpp>
|
||||
|
||||
@ -26,6 +27,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
// read a delimiter
|
||||
template <typename IS>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
static void
|
||||
read(IS& is, char const* delim, mpl::false_ = mpl::false_())
|
||||
{
|
||||
@ -34,6 +36,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
}
|
||||
|
||||
template <typename IS>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
static void
|
||||
read(IS&, char const*, mpl::true_)
|
||||
{
|
||||
@ -43,12 +46,14 @@ namespace boost { namespace fusion { namespace detail
|
||||
struct read_sequence_loop
|
||||
{
|
||||
template <typename IS, typename First, typename Last>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
static void
|
||||
call(IS&, First const&, Last const&, mpl::true_)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename IS, typename First, typename Last>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
static void
|
||||
call(IS& is, First const& first, Last const& last, mpl::false_)
|
||||
{
|
||||
@ -64,6 +69,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
}
|
||||
|
||||
template <typename IS, typename First, typename Last>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
static void
|
||||
call(IS& is, First const& first, Last const& last)
|
||||
{
|
||||
@ -73,6 +79,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
};
|
||||
|
||||
template <typename IS, typename Sequence>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline void
|
||||
read_sequence(IS& is, Sequence& seq)
|
||||
{
|
||||
|
@ -9,6 +9,7 @@
|
||||
#if !defined(FUSION_MANIP_05052005_1200)
|
||||
#define FUSION_MANIP_05052005_1200
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -35,6 +36,7 @@ namespace boost { namespace fusion
|
||||
namespace detail
|
||||
{
|
||||
template <typename Tag>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
int get_xalloc_index(Tag* = 0)
|
||||
{
|
||||
// each Tag will have a unique index
|
||||
@ -47,6 +49,7 @@ namespace boost { namespace fusion
|
||||
{
|
||||
struct arena
|
||||
{
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
~arena()
|
||||
{
|
||||
for (
|
||||
@ -61,6 +64,7 @@ namespace boost { namespace fusion
|
||||
std::vector<T*> data;
|
||||
};
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
static void attach(Stream& stream, T const& data)
|
||||
{
|
||||
static arena ar; // our arena
|
||||
@ -68,6 +72,7 @@ namespace boost { namespace fusion
|
||||
stream.pword(get_xalloc_index<Tag>()) = ar.data.back();
|
||||
}
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
static T const* get(Stream& stream)
|
||||
{
|
||||
return (T const*)stream.pword(get_xalloc_index<Tag>());
|
||||
@ -83,16 +88,19 @@ namespace boost { namespace fusion
|
||||
|
||||
typedef stream_data<Stream, Tag, string_type> stream_data_t;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
string_ios_manip(Stream& str_)
|
||||
: stream(str_)
|
||||
{}
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
void
|
||||
set(string_type const& s)
|
||||
{
|
||||
stream_data_t::attach(stream, s);
|
||||
}
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
void
|
||||
print(char const* default_) const
|
||||
{
|
||||
@ -104,6 +112,7 @@ namespace boost { namespace fusion
|
||||
stream << default_;
|
||||
}
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
void
|
||||
read(char const* default_) const
|
||||
{
|
||||
@ -128,6 +137,7 @@ namespace boost { namespace fusion
|
||||
private:
|
||||
|
||||
template <typename Char>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
void
|
||||
check_delim(Char c) const
|
||||
{
|
||||
@ -155,30 +165,35 @@ namespace boost { namespace fusion
|
||||
|
||||
#define STD_TUPLE_DEFINE_MANIPULATOR_FUNCTIONS(name) \
|
||||
template <typename Char, typename Traits> \
|
||||
BOOST_FUSION_GPU_ENABLED \
|
||||
inline detail::name##_type<Char, Traits> \
|
||||
name(const std::basic_string<Char, Traits>& s) \
|
||||
{ \
|
||||
return detail::name##_type<Char, Traits>(s); \
|
||||
} \
|
||||
\
|
||||
BOOST_FUSION_GPU_ENABLED \
|
||||
inline detail::name##_type<char> \
|
||||
name(char const* s) \
|
||||
{ \
|
||||
return detail::name##_type<char>(std::basic_string<char>(s)); \
|
||||
} \
|
||||
\
|
||||
BOOST_FUSION_GPU_ENABLED \
|
||||
inline detail::name##_type<wchar_t> \
|
||||
name(wchar_t const* s) \
|
||||
{ \
|
||||
return detail::name##_type<wchar_t>(std::basic_string<wchar_t>(s)); \
|
||||
} \
|
||||
\
|
||||
BOOST_FUSION_GPU_ENABLED \
|
||||
inline detail::name##_type<char> \
|
||||
name(char c) \
|
||||
{ \
|
||||
return detail::name##_type<char>(std::basic_string<char>(1, c)); \
|
||||
} \
|
||||
\
|
||||
BOOST_FUSION_GPU_ENABLED \
|
||||
inline detail::name##_type<wchar_t> \
|
||||
name(wchar_t c) \
|
||||
{ \
|
||||
@ -189,6 +204,7 @@ namespace boost { namespace fusion
|
||||
|
||||
#define STD_TUPLE_DEFINE_MANIPULATOR_FUNCTIONS(name) \
|
||||
template <typename Char, typename Traits> \
|
||||
BOOST_FUSION_GPU_ENABLED \
|
||||
inline detail::name##_type<Char, Traits> \
|
||||
name(const std::basic_string<Char, Traits>& s) \
|
||||
{ \
|
||||
@ -196,6 +212,7 @@ namespace boost { namespace fusion
|
||||
} \
|
||||
\
|
||||
template <typename Char> \
|
||||
BOOST_FUSION_GPU_ENABLED \
|
||||
inline detail::name##_type<Char> \
|
||||
name(Char s[]) \
|
||||
{ \
|
||||
@ -203,6 +220,7 @@ namespace boost { namespace fusion
|
||||
} \
|
||||
\
|
||||
template <typename Char> \
|
||||
BOOST_FUSION_GPU_ENABLED \
|
||||
inline detail::name##_type<Char> \
|
||||
name(Char const s[]) \
|
||||
{ \
|
||||
@ -210,6 +228,7 @@ namespace boost { namespace fusion
|
||||
} \
|
||||
\
|
||||
template <typename Char> \
|
||||
BOOST_FUSION_GPU_ENABLED \
|
||||
inline detail::name##_type<Char> \
|
||||
name(Char c) \
|
||||
{ \
|
||||
@ -228,10 +247,12 @@ namespace boost { namespace fusion
|
||||
{ \
|
||||
typedef std::basic_string<Char, Traits> string_type; \
|
||||
string_type data; \
|
||||
BOOST_FUSION_GPU_ENABLED \
|
||||
name##_type(const string_type& d): data(d) {} \
|
||||
}; \
|
||||
\
|
||||
template <typename Stream, typename Char, typename Traits> \
|
||||
BOOST_FUSION_GPU_ENABLED \
|
||||
Stream& operator>>(Stream& s, const name##_type<Char,Traits>& m) \
|
||||
{ \
|
||||
string_ios_manip<name##_tag, Stream>(s).set(m.data); \
|
||||
@ -239,6 +260,7 @@ namespace boost { namespace fusion
|
||||
} \
|
||||
\
|
||||
template <typename Stream, typename Char, typename Traits> \
|
||||
BOOST_FUSION_GPU_ENABLED \
|
||||
Stream& operator<<(Stream& s, const name##_type<Char,Traits>& m) \
|
||||
{ \
|
||||
string_ios_manip<name##_tag, Stream>(s).set(m.data); \
|
||||
|
@ -9,6 +9,7 @@
|
||||
#if !defined(FUSION_OUT_05052005_0121)
|
||||
#define FUSION_OUT_05052005_0121
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <ostream>
|
||||
#include <boost/fusion/sequence/io/detail/manip.hpp>
|
||||
|
||||
@ -26,6 +27,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
// print a delimiter
|
||||
template <typename OS>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
static void
|
||||
print(OS& os, char const* delim, mpl::false_ = mpl::false_())
|
||||
{
|
||||
@ -34,6 +36,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
}
|
||||
|
||||
template <typename OS>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
static void
|
||||
print(OS&, char const*, mpl::true_)
|
||||
{
|
||||
@ -43,12 +46,14 @@ namespace boost { namespace fusion { namespace detail
|
||||
struct print_sequence_loop
|
||||
{
|
||||
template <typename OS, typename First, typename Last>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
static void
|
||||
call(OS&, First const&, Last const&, mpl::true_)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename OS, typename First, typename Last>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
static void
|
||||
call(OS& os, First const& first, Last const& last, mpl::false_)
|
||||
{
|
||||
@ -64,6 +69,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
}
|
||||
|
||||
template <typename OS, typename First, typename Last>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
static void
|
||||
call(OS& os, First const& first, Last const& last)
|
||||
{
|
||||
@ -73,6 +79,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
};
|
||||
|
||||
template <typename OS, typename Sequence>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline void
|
||||
print_sequence(OS& os, Sequence const& seq)
|
||||
{
|
||||
|
@ -9,6 +9,7 @@
|
||||
#if !defined(BOOST_IN_05042005_0120)
|
||||
#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>
|
||||
@ -16,6 +17,7 @@
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
template <typename Sequence>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline std::istream&
|
||||
in(std::istream& is, Sequence& seq)
|
||||
{
|
||||
@ -26,6 +28,7 @@ namespace boost { namespace fusion
|
||||
namespace operators
|
||||
{
|
||||
template <typename Sequence>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline typename
|
||||
boost::enable_if<
|
||||
fusion::traits::is_sequence<Sequence>
|
||||
|
@ -9,6 +9,7 @@
|
||||
#if !defined(BOOST_OUT_05042005_0120)
|
||||
#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>
|
||||
@ -18,6 +19,7 @@
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
template <typename Sequence>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline std::ostream&
|
||||
out(std::ostream& os, Sequence& seq)
|
||||
{
|
||||
@ -28,6 +30,7 @@ namespace boost { namespace fusion
|
||||
namespace operators
|
||||
{
|
||||
template <typename Sequence>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline typename
|
||||
boost::enable_if<
|
||||
fusion::traits::is_sequence<Sequence>
|
||||
|
Reference in New Issue
Block a user