1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-11-12 21:09:01 +00:00

fix tuple construction, darkroom rgb & vector3d construction

This commit is contained in:
bolero-MURAKAMI 2013-03-27 02:02:16 +09:00
parent c78e1d0e6d
commit 2e8b85e90c
53 changed files with 262 additions and 196 deletions

View file

@ -29,34 +29,44 @@ namespace testspr {
TESTSPR_BOTH_ASSERT(sprout::tuples::get<1>(tup3) == 1.0); TESTSPR_BOTH_ASSERT(sprout::tuples::get<1>(tup3) == 1.0);
} }
{
SPROUT_STATIC_CONSTEXPR auto tup3 = sprout::tuples::tuple<int, double>(1l);
TESTSPR_BOTH_ASSERT(sprout::tuples::get<0>(tup3) == 1);
TESTSPR_BOTH_ASSERT(sprout::tuples::get<1>(tup3) == 0.0);
}
{ {
SPROUT_STATIC_CONSTEXPR auto tup3 = sprout::tuples::tuple<int, double>(1l, 1.0f); SPROUT_STATIC_CONSTEXPR auto tup3 = sprout::tuples::tuple<int, double>(1l, 1.0f);
TESTSPR_BOTH_ASSERT(sprout::tuples::get<0>(tup3) == 1); TESTSPR_BOTH_ASSERT(sprout::tuples::get<0>(tup3) == 1);
TESTSPR_BOTH_ASSERT(sprout::tuples::get<1>(tup3) == 1.0); TESTSPR_BOTH_ASSERT(sprout::tuples::get<1>(tup3) == 1.0);
} }
{ {
SPROUT_STATIC_CONSTEXPR auto tup3 = sprout::tuples::tuple<int, double>(1l, 1.0f, '-'); SPROUT_STATIC_CONSTEXPR auto tup3 = sprout::tuples::tuple<int, double>(sprout::tuples::flexibly_construct, 1l);
TESTSPR_BOTH_ASSERT(sprout::tuples::get<0>(tup3) == 1);
TESTSPR_BOTH_ASSERT(sprout::tuples::get<1>(tup3) == 0.0);
}
{
SPROUT_STATIC_CONSTEXPR auto tup3 = sprout::tuples::tuple<int, double>(sprout::tuples::flexibly_construct, 1l, 1.0f);
TESTSPR_BOTH_ASSERT(sprout::tuples::get<0>(tup3) == 1);
TESTSPR_BOTH_ASSERT(sprout::tuples::get<1>(tup3) == 1.0);
}
{
SPROUT_STATIC_CONSTEXPR auto tup3 = sprout::tuples::tuple<int, double>(sprout::tuples::flexibly_construct, 1l, 1.0f, '-');
TESTSPR_BOTH_ASSERT(sprout::tuples::get<0>(tup3) == 1); TESTSPR_BOTH_ASSERT(sprout::tuples::get<0>(tup3) == 1);
TESTSPR_BOTH_ASSERT(sprout::tuples::get<1>(tup3) == 1.0); TESTSPR_BOTH_ASSERT(sprout::tuples::get<1>(tup3) == 1.0);
} }
{
SPROUT_STATIC_CONSTEXPR auto tup3 = sprout::tuples::tuple<int, double>(sprout::tuples::tuple<long>(1l));
TESTSPR_BOTH_ASSERT(sprout::tuples::get<0>(tup3) == 1);
TESTSPR_BOTH_ASSERT(sprout::tuples::get<1>(tup3) == 0.0);
}
{ {
SPROUT_STATIC_CONSTEXPR auto tup3 = sprout::tuples::tuple<int, double>(sprout::tuples::tuple<long, float>(1l, 1.0f)); SPROUT_STATIC_CONSTEXPR auto tup3 = sprout::tuples::tuple<int, double>(sprout::tuples::tuple<long, float>(1l, 1.0f));
TESTSPR_BOTH_ASSERT(sprout::tuples::get<0>(tup3) == 1); TESTSPR_BOTH_ASSERT(sprout::tuples::get<0>(tup3) == 1);
TESTSPR_BOTH_ASSERT(sprout::tuples::get<1>(tup3) == 1.0); TESTSPR_BOTH_ASSERT(sprout::tuples::get<1>(tup3) == 1.0);
} }
{ {
SPROUT_STATIC_CONSTEXPR auto tup3 = sprout::tuples::tuple<int, double>(sprout::tuples::tuple<long, float, char>(1l, 1.0f, '-')); SPROUT_STATIC_CONSTEXPR auto tup3 = sprout::tuples::tuple<int, double>(sprout::tuples::flexibly_construct, sprout::tuples::tuple<long>(1l));
TESTSPR_BOTH_ASSERT(sprout::tuples::get<0>(tup3) == 1);
TESTSPR_BOTH_ASSERT(sprout::tuples::get<1>(tup3) == 0.0);
}
{
SPROUT_STATIC_CONSTEXPR auto tup3 = sprout::tuples::tuple<int, double>(sprout::tuples::flexibly_construct, sprout::tuples::tuple<long, float>(1l, 1.0f));
TESTSPR_BOTH_ASSERT(sprout::tuples::get<0>(tup3) == 1);
TESTSPR_BOTH_ASSERT(sprout::tuples::get<1>(tup3) == 1.0);
}
{
SPROUT_STATIC_CONSTEXPR auto tup3 = sprout::tuples::tuple<int, double>(sprout::tuples::flexibly_construct, sprout::tuples::tuple<long, float, char>(1l, 1.0f, '-'));
TESTSPR_BOTH_ASSERT(sprout::tuples::get<0>(tup3) == 1); TESTSPR_BOTH_ASSERT(sprout::tuples::get<0>(tup3) == 1);
TESTSPR_BOTH_ASSERT(sprout::tuples::get<1>(tup3) == 1.0); TESTSPR_BOTH_ASSERT(sprout::tuples::get<1>(tup3) == 1.0);
} }

View file

@ -62,9 +62,8 @@ namespace sprout {
// join // join
// //
template<typename ContainerContainer, typename Separator = void> template<typename ContainerContainer, typename Separator = void>
struct join { struct join
public: : public sprout::container_transform_traits<
typedef typename sprout::container_transform_traits<
typename sprout::container_traits<ContainerContainer>::value_type typename sprout::container_traits<ContainerContainer>::value_type
>::template rebind_size< >::template rebind_size<
sprout::container_traits< sprout::container_traits<
@ -78,20 +77,19 @@ namespace sprout {
* sprout::container_traits<ContainerContainer>::static_size * sprout::container_traits<ContainerContainer>::static_size
- sprout::algorithm::detail::string_size<Separator>::value - sprout::algorithm::detail::string_size<Separator>::value
: 0 : 0
>::type type; >
}; {};
template<typename ContainerContainer> template<typename ContainerContainer>
struct join<ContainerContainer, void> { struct join<ContainerContainer, void>
public: : public sprout::container_transform_traits<
typedef typename sprout::container_transform_traits<
typename sprout::container_traits<ContainerContainer>::value_type typename sprout::container_traits<ContainerContainer>::value_type
>::template rebind_size< >::template rebind_size<
sprout::container_traits< sprout::container_traits<
typename sprout::container_traits<ContainerContainer>::value_type typename sprout::container_traits<ContainerContainer>::value_type
>::static_size >::static_size
* sprout::container_traits<ContainerContainer>::static_size * sprout::container_traits<ContainerContainer>::static_size
>::type type; >
}; {};
} // namespace result_of } // namespace result_of
namespace detail { namespace detail {

View file

@ -11,14 +11,11 @@ namespace sprout {
// internal // internal
// //
template<typename Container> template<typename Container>
struct internal { struct internal
public: : public sprout::sub_container_traits<
typedef typename sprout::sub_container_traits<
typename std::remove_reference<Container>::type typename std::remove_reference<Container>::type
>::template internal< >::template internal<Container>
Container {};
>::type type;
};
} // namespace containers } // namespace containers
} // namespace sprout } // namespace sprout

View file

@ -52,11 +52,26 @@ namespace sprout {
} }
// //
// rgb_t
// rgb // rgb
//
typedef sprout::tuples::tuple<std::uint8_t, std::uint8_t, std::uint8_t> rgb_t;
inline SPROUT_CONSTEXPR sprout::darkroom::colors::rgb_t
rgb(std::uint8_t r = 0, std::uint8_t g = 0, std::uint8_t b = 0) {
return sprout::darkroom::colors::rgb_t(r, g, b);
}
//
// rgb_f_t
// rgb_f // rgb_f
// //
typedef sprout::tuples::tuple<std::uint8_t, std::uint8_t, std::uint8_t> rgb; typedef sprout::tuples::tuple<double, double, double> rgb_f_t;
typedef sprout::tuples::tuple<double, double, double> rgb_f;
inline SPROUT_CONSTEXPR sprout::darkroom::colors::rgb_f_t
rgb_f(double r = 0, double g = 0, double b = 0) {
return sprout::darkroom::colors::rgb_f_t(r, g, b);
}
// //
// mul // mul

View file

@ -42,9 +42,15 @@ namespace sprout {
} }
// //
// vector3d_t
// vector3d // vector3d
// //
typedef sprout::tuples::tuple<double, double, double> vector3d; typedef sprout::tuples::tuple<double, double, double> vector3d_t;
inline SPROUT_CONSTEXPR sprout::darkroom::coords::vector3d_t
vector3d(double x = 0, double y = 0, double z = 0) {
return sprout::darkroom::coords::vector3d_t(x, y, z);
}
// //
// length_sq // length_sq

View file

@ -74,8 +74,8 @@ namespace sprout {
typedef sprout::tuples::tuple< typedef sprout::tuples::tuple<
bool, bool,
double, double,
sprout::darkroom::coords::vector3d, sprout::darkroom::coords::vector3d_t,
sprout::darkroom::coords::vector3d, sprout::darkroom::coords::vector3d_t,
sprout::darkroom::materials::material sprout::darkroom::materials::material
> intersection; > intersection;
} // namespace intersects } // namespace intersects

View file

@ -15,7 +15,7 @@ namespace sprout {
// //
// basic_ambient_light // basic_ambient_light
// //
template<typename Color = sprout::darkroom::colors::rgb_f> template<typename Color = sprout::darkroom::colors::rgb_f_t>
class basic_ambient_light { class basic_ambient_light {
public: public:
typedef Color color_type; typedef Color color_type;

View file

@ -19,8 +19,8 @@ namespace sprout {
// basic_parallel_light // basic_parallel_light
// //
template< template<
typename Position = sprout::darkroom::coords::vector3d, typename Position = sprout::darkroom::coords::vector3d_t,
typename Color = sprout::darkroom::colors::rgb_f typename Color = sprout::darkroom::colors::rgb_f_t
> >
class basic_parallel_light { class basic_parallel_light {
public: public:

View file

@ -19,8 +19,8 @@ namespace sprout {
// basic_point_light // basic_point_light
// //
template< template<
typename Position = sprout::darkroom::coords::vector3d, typename Position = sprout::darkroom::coords::vector3d_t,
typename Color = sprout::darkroom::colors::rgb_f typename Color = sprout::darkroom::colors::rgb_f_t
> >
class basic_point_light { class basic_point_light {
public: public:

View file

@ -81,7 +81,7 @@ namespace sprout {
// //
// material // material
// //
typedef sprout::tuples::tuple<sprout::darkroom::colors::rgb_f, double> material; typedef sprout::tuples::tuple<sprout::darkroom::colors::rgb_f_t, double> material;
} // namespace materials } // namespace materials
} // namespace darkroom } // namespace darkroom
} // namespace sprout } // namespace sprout

View file

@ -27,7 +27,7 @@ namespace sprout {
// //
// basic_aa_plane // basic_aa_plane
// //
template<typename Material, typename Position = sprout::darkroom::coords::vector3d> template<typename Material, typename Position = sprout::darkroom::coords::vector3d_t>
class basic_aa_plane { class basic_aa_plane {
public: public:
typedef Material material_type; typedef Material material_type;

View file

@ -17,7 +17,7 @@ namespace sprout {
// //
// basic_triangle // basic_triangle
// //
template<typename Material, typename Vertex = sprout::darkroom::coords::vector3d> template<typename Material, typename Vertex = sprout::darkroom::coords::vector3d_t>
class basic_triangle { class basic_triangle {
public: public:
typedef Material material_type; typedef Material material_type;

View file

@ -20,7 +20,7 @@ namespace sprout {
// //
// basic_sphere // basic_sphere
// //
template<typename Material, typename Position = sprout::darkroom::coords::vector3d> template<typename Material, typename Position = sprout::darkroom::coords::vector3d_t>
class basic_sphere { class basic_sphere {
public: public:
typedef Material material_type; typedef Material material_type;

View file

@ -125,7 +125,7 @@ namespace sprout {
// //
// color_pixels // color_pixels
// //
template<std::size_t Width, std::size_t Height, typename Color = sprout::darkroom::colors::rgb> template<std::size_t Width, std::size_t Height, typename Color = sprout::darkroom::colors::rgb_t>
struct color_pixels { struct color_pixels {
public: public:
typedef sprout::array<sprout::array<Color, Width>, Height> type; typedef sprout::array<sprout::array<Color, Width>, Height> type;

View file

@ -43,7 +43,7 @@ namespace sprout {
// //
// ray // ray
// //
typedef sprout::tuples::tuple<sprout::darkroom::coords::vector3d, sprout::darkroom::coords::vector3d> ray; typedef sprout::tuples::tuple<sprout::darkroom::coords::vector3d_t, sprout::darkroom::coords::vector3d_t> ray;
// //
// point_of_intersection // point_of_intersection

View file

@ -44,7 +44,7 @@ namespace sprout {
// //
// uniform_color // uniform_color
// //
template<typename Color = sprout::darkroom::colors::rgb_f> template<typename Color = sprout::darkroom::colors::rgb_f_t>
class uniform_color { class uniform_color {
public: public:
typedef Color color_type; typedef Color color_type;

View file

@ -47,7 +47,7 @@ namespace sprout {
// //
// image_type // image_type
// //
template<std::size_t Width, std::size_t Height, typename Color = sprout::darkroom::colors::rgb_f> template<std::size_t Width, std::size_t Height, typename Color = sprout::darkroom::colors::rgb_f_t>
struct image_type { struct image_type {
public: public:
typedef Color color_type; typedef Color color_type;

View file

@ -11,7 +11,7 @@ namespace sprout {
// //
// raytracer // raytracer
// //
template<typename Color = sprout::darkroom::colors::rgb_f> template<typename Color = sprout::darkroom::colors::rgb_f_t>
class raytracer { class raytracer {
public: public:
typedef Color color_type; typedef Color color_type;

View file

@ -14,14 +14,13 @@ namespace sprout {
// append // append
// //
template<typename Container, typename Input> template<typename Container, typename Input>
struct append { struct append
public: : public sprout::container_transform_traits<
typedef typename sprout::container_transform_traits<
Container Container
>::template rebind_size< >::template rebind_size<
sprout::container_traits<Container>::static_size + sprout::container_traits<Input>::static_size sprout::container_traits<Container>::static_size + sprout::container_traits<Input>::static_size
>::type type; >
}; {};
} // namespace result_of } // namespace result_of
namespace detail { namespace detail {

View file

@ -14,14 +14,14 @@ namespace sprout {
// erase // erase
// //
template<typename Container> template<typename Container>
struct erase { struct erase
static_assert(sprout::container_traits<Container>::static_size >= 1, "static_size >= 1"); : public sprout::container_transform_traits<
public:
typedef typename sprout::container_transform_traits<
Container Container
>::template rebind_size< >::template rebind_size<
sprout::container_traits<Container>::static_size - 1 sprout::container_traits<Container>::static_size - 1
>::type type; >
{
static_assert(sprout::container_traits<Container>::static_size >= 1, "static_size >= 1");
}; };
} // namespace result_of } // namespace result_of

View file

@ -15,14 +15,14 @@ namespace sprout {
// erase_n // erase_n
// //
template<std::size_t N, typename Container> template<std::size_t N, typename Container>
struct erase_n { struct erase_n
static_assert(sprout::container_traits<Container>::static_size >= N, "static_size >= N"); : public sprout::container_transform_traits<
public:
typedef typename sprout::container_transform_traits<
Container Container
>::template rebind_size< >::template rebind_size<
sprout::container_traits<Container>::static_size - N sprout::container_traits<Container>::static_size - N
>::type type; >
{
static_assert(sprout::container_traits<Container>::static_size >= N, "static_size >= N");
}; };
} // namespace result_of } // namespace result_of

View file

@ -16,14 +16,13 @@ namespace sprout {
// insert // insert
// //
template<typename Container, typename T, typename... Values> template<typename Container, typename T, typename... Values>
struct insert { struct insert
public: : public sprout::container_transform_traits<
typedef typename sprout::container_transform_traits<
Container Container
>::template rebind_size< >::template rebind_size<
sprout::container_traits<Container>::static_size + 1 + sizeof...(Values) sprout::container_traits<Container>::static_size + 1 + sizeof...(Values)
>::type type; >
}; {};
} // namespace result_of } // namespace result_of
namespace detail { namespace detail {

View file

@ -18,14 +18,13 @@ namespace sprout {
// insert_n // insert_n
// //
template<std::size_t N, typename Container, typename T, typename... Values> template<std::size_t N, typename Container, typename T, typename... Values>
struct insert_n { struct insert_n
public: : public sprout::container_transform_traits<
typedef typename sprout::container_transform_traits<
Container Container
>::template rebind_size< >::template rebind_size<
sprout::container_traits<Container>::static_size + (1 + sizeof...(Values)) * N sprout::container_traits<Container>::static_size + (1 + sizeof...(Values)) * N
>::type type; >
}; {};
} // namespace result_of } // namespace result_of
namespace detail { namespace detail {

View file

@ -15,14 +15,13 @@ namespace sprout {
// resize // resize
// //
template<std::size_t N, typename Container> template<std::size_t N, typename Container>
struct resize { struct resize
public: : public sprout::container_transform_traits<
typedef typename sprout::container_transform_traits<
Container Container
>::template rebind_size< >::template rebind_size<
N N
>::type type; >
}; {};
} // namespace result_of } // namespace result_of
namespace detail { namespace detail {

View file

@ -132,40 +132,35 @@ namespace sprout {
}; };
template<typename LRange, typename RRange, typename = void> template<typename LRange, typename RRange, typename = void>
class jointed_range_copied_type; struct jointed_range_copied_type;
template<typename LRange, typename RRange> template<typename LRange, typename RRange>
class jointed_range_copied_type< struct jointed_range_copied_type<
LRange, RRange, LRange, RRange,
typename std::enable_if< typename std::enable_if<
sprout::containers::is_rebindable_size<LRange>::value sprout::containers::is_rebindable_size<LRange>::value
>::type >::type
> { >
public: : public sprout::container_construct_traits<
typedef typename sprout::container_construct_traits<
typename sprout::containers::weak_rebind_size< typename sprout::containers::weak_rebind_size<
typename sprout::container_construct_traits<LRange>::copied_type, typename sprout::container_construct_traits<LRange>::copied_type,
sprout::adaptors::detail::jointed_range_size<LRange, RRange>::static_size sprout::adaptors::detail::jointed_range_size<LRange, RRange>::static_size
>::type >::type
>::type copied_type; >
}; {};
template<typename LRange, typename RRange> template<typename LRange, typename RRange>
class jointed_range_copied_type< struct jointed_range_copied_type<
LRange, RRange, LRange, RRange,
typename std::enable_if< typename std::enable_if<
!sprout::containers::is_rebindable_size<LRange>::value && sprout::containers::is_rebindable_size<RRange>::value !sprout::containers::is_rebindable_size<LRange>::value && sprout::containers::is_rebindable_size<RRange>::value
>::type >::type
> { >
public: : public sprout::containers::weak_rebind_size<
typedef typename sprout::containers::weak_rebind_size<
typename sprout::container_construct_traits<RRange>::copied_type, typename sprout::container_construct_traits<RRange>::copied_type,
sprout::adaptors::detail::jointed_range_size<LRange, RRange>::static_size sprout::adaptors::detail::jointed_range_size<LRange, RRange>::static_size
>::type type; >
}; {};
template<typename LRange, typename RRange> template<typename LRange, typename RRange>
class jointed_range_copied_type< struct jointed_range_copied_type<
LRange, RRange, LRange, RRange,
typename std::enable_if< typename std::enable_if<
!sprout::containers::is_rebindable_size<LRange>::value && !sprout::containers::is_rebindable_size<RRange>::value !sprout::containers::is_rebindable_size<LRange>::value && !sprout::containers::is_rebindable_size<RRange>::value

View file

@ -46,14 +46,13 @@ namespace sprout {
template<typename Tuple, typename IndexTuple> template<typename Tuple, typename IndexTuple>
struct default_copied; struct default_copied;
template<typename Tuple, sprout::index_t... Indexes> template<typename Tuple, sprout::index_t... Indexes>
struct default_copied<Tuple, sprout::index_tuple<Indexes...> > { struct default_copied<Tuple, sprout::index_tuple<Indexes...> >
public: : public sprout::tuples::rebind_types<Tuple>::template apply<
typedef typename sprout::tuples::rebind_types<Tuple>::template apply<
typename std::decay< typename std::decay<
typename sprout::tuples::tuple_element<Indexes, Tuple>::type typename sprout::tuples::tuple_element<Indexes, Tuple>::type
>::type... >::type...
>::type type; >
}; {};
template<typename Tuple, typename... Args> template<typename Tuple, typename... Args>
SPROUT_CONSTEXPR typename sprout::tuples::tuple_construct_traits<Tuple>::copied_type SPROUT_CONSTEXPR typename sprout::tuples::tuple_construct_traits<Tuple>::copied_type

View file

@ -10,5 +10,6 @@
#include <sprout/tuple/tuple/ignore.hpp> #include <sprout/tuple/tuple/ignore.hpp>
#include <sprout/tuple/tuple/make_tuple.hpp> #include <sprout/tuple/tuple/make_tuple.hpp>
#include <sprout/tuple/tuple/type_traits.hpp> #include <sprout/tuple/tuple/type_traits.hpp>
#include <sprout/tuple/tuple/flexibly_construct.hpp>
#endif // #ifndef SPROUT_TUPLE_TUPLE_HPP #endif // #ifndef SPROUT_TUPLE_TUPLE_HPP

View file

@ -0,0 +1,20 @@
#ifndef SPROUT_TUPLE_TUPLE_FREXIBLY_CONSTRUCT_HPP
#define SPROUT_TUPLE_TUPLE_FREXIBLY_CONSTRUCT_HPP
#include <sprout/config.hpp>
namespace sprout {
namespace tuples {
//
// flexibly_construct_t
// flexibly_construct
//
struct flexibly_construct_t {};
SPROUT_STATIC_CONSTEXPR sprout::tuples::flexibly_construct_t flexibly_construct = {};
} // namespace tuples
using sprout::tuples::flexibly_construct_t;
using sprout::tuples::flexibly_construct;
} // namespace sprout
#endif // #ifndef SPROUT_TUPLE_TUPLE_FREXIBLY_CONSTRUCT_HPP

View file

@ -40,26 +40,23 @@ namespace sprout {
: public std::tuple_element<I, T> : public std::tuple_element<I, T>
{}; {};
template<std::size_t I, typename T> template<std::size_t I, typename T>
struct tuple_element<I, T const> { struct tuple_element<I, T const>
public: : public std::add_const<
typedef typename std::add_const<
typename sprout::tuples::tuple_element<I, T>::type typename sprout::tuples::tuple_element<I, T>::type
>::type type; >
}; {};
template<std::size_t I, typename T> template<std::size_t I, typename T>
struct tuple_element<I, T volatile> { struct tuple_element<I, T volatile>
public: : public std::add_volatile<
typedef typename std::add_volatile<
typename sprout::tuples::tuple_element<I, T>::type typename sprout::tuples::tuple_element<I, T>::type
>::type type; >
}; {};
template<std::size_t I, typename T> template<std::size_t I, typename T>
struct tuple_element<I, T const volatile> { struct tuple_element<I, T const volatile>
public: : public std::add_cv<
typedef typename std::add_cv<
typename sprout::tuples::tuple_element<I, T>::type typename sprout::tuples::tuple_element<I, T>::type
>::type type; >
}; {};
namespace detail { namespace detail {
template<std::size_t I, typename Head, typename... Tail> template<std::size_t I, typename Head, typename... Tail>

View file

@ -103,12 +103,11 @@ namespace sprout {
typedef sprout::index_tuple<> type; typedef sprout::index_tuple<> type;
}; };
template<typename Head, typename... Tail> template<typename Head, typename... Tail>
struct tuple_cat_1st_indexes<Head, Tail...> { struct tuple_cat_1st_indexes<Head, Tail...>
public: : public sprout::index_range<
typedef typename sprout::index_range<
0, sprout::tuples::tuple_size<typename std::remove_reference<Head>::type>::value 0, sprout::tuples::tuple_size<typename std::remove_reference<Head>::type>::value
>::type type; >
}; {};
template<typename Result, typename IndexTuple, typename... Tuples> template<typename Result, typename IndexTuple, typename... Tuples>
struct tuple_cat_impl; struct tuple_cat_impl;

View file

@ -9,8 +9,10 @@
#include <sprout/utility/forward.hpp> #include <sprout/utility/forward.hpp>
#include <sprout/utility/move.hpp> #include <sprout/utility/move.hpp>
#include <sprout/utility/swap.hpp> #include <sprout/utility/swap.hpp>
#include <sprout/type_traits/is_convert_constructible.hpp>
#include <sprout/tpp/algorithm/all_of.hpp>
#include <sprout/tuple/tuple/tuple_fwd.hpp> #include <sprout/tuple/tuple/tuple_fwd.hpp>
#include <sprout/tuple/tuple/type_traits.hpp> #include <sprout/tuple/tuple/flexibly_construct.hpp>
namespace sprout { namespace sprout {
namespace tuples { namespace tuples {
@ -247,32 +249,46 @@ namespace sprout {
: inherited_type(elements...) : inherited_type(elements...)
{} {}
template< template<
typename U, typename... UTypes,
typename = typename std::enable_if< typename = typename std::enable_if<
!sprout::tuples::is_tuple<typename std::remove_reference<U>::type>::value sizeof...(Types) == sizeof...(UTypes) && sprout::tpp::all_of<sprout::is_convert_constructible<Types, UTypes&&>...>::value
>::type >::type
> >
explicit SPROUT_CONSTEXPR tuple(U&& elem) explicit SPROUT_CONSTEXPR tuple(UTypes&&... elements)
: inherited_type(sprout::forward<U>(elem)) : inherited_type(sprout::forward<UTypes>(elements)...)
{} {}
template< template<typename... UTypes>
typename U1, explicit SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, UTypes&&... elements)
typename U2, : inherited_type(sprout::forward<UTypes>(elements)...)
typename... UTypes
>
explicit SPROUT_CONSTEXPR tuple(U1&& elem1, U2&& elem2, UTypes&&... elements)
: inherited_type(sprout::forward<U1>(elem1), sprout::forward<U2>(elem2), sprout::forward<UTypes>(elements)...)
{} {}
SPROUT_CONSTEXPR tuple(tuple const&) = default; SPROUT_CONSTEXPR tuple(tuple const&) = default;
SPROUT_CONSTEXPR tuple(tuple&&) = default; SPROUT_CONSTEXPR tuple(tuple&&) = default;
template<typename... UTypes> template<
typename... UTypes,
typename = typename std::enable_if<
sizeof...(Types) == sizeof...(UTypes) && sprout::tpp::all_of<sprout::is_convert_constructible<Types, UTypes const&>...>::value
>::type
>
SPROUT_CONSTEXPR tuple(sprout::tuples::tuple<UTypes...> const& t) SPROUT_CONSTEXPR tuple(sprout::tuples::tuple<UTypes...> const& t)
: inherited_type(static_cast<sprout::tuples::detail::tuple_impl<0, UTypes...> const&>(t)) : inherited_type(static_cast<sprout::tuples::detail::tuple_impl<0, UTypes...> const&>(t))
{} {}
template<typename... UTypes> template<
typename... UTypes,
typename = typename std::enable_if<
sizeof...(Types) == sizeof...(UTypes) && sprout::tpp::all_of<sprout::is_convert_constructible<Types, UTypes&&>...>::value
>::type
>
SPROUT_CONSTEXPR tuple(sprout::tuples::tuple<UTypes...>&& t) SPROUT_CONSTEXPR tuple(sprout::tuples::tuple<UTypes...>&& t)
: inherited_type(static_cast<sprout::tuples::detail::tuple_impl<0, UTypes...>&&>(t)) : inherited_type(static_cast<sprout::tuples::detail::tuple_impl<0, UTypes...>&&>(t))
{} {}
template<typename... UTypes>
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::tuples::tuple<UTypes...> const& t)
: inherited_type(static_cast<sprout::tuples::detail::tuple_impl<0, UTypes...> const&>(t))
{}
template<typename... UTypes>
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::tuples::tuple<UTypes...>&& t)
: inherited_type(static_cast<sprout::tuples::detail::tuple_impl<0, UTypes...>&&>(t))
{}
// tuple assignment // tuple assignment
tuple& operator=(tuple const& rhs) { tuple& operator=(tuple const& rhs) {
static_cast<inherited_type&>(*this) = rhs; static_cast<inherited_type&>(*this) = rhs;

View file

@ -9,10 +9,9 @@ namespace sprout {
// advance // advance
// //
template<typename Iterator, std::ptrdiff_t Disatnce, typename Enable = void> template<typename Iterator, std::ptrdiff_t Disatnce, typename Enable = void>
struct advance { struct advance
public: : public Iterator::template advance<Disatnce>
typedef typename Iterator::template advance<Disatnce>::type type; {};
};
template<typename Iterator, std::ptrdiff_t Disatnce> template<typename Iterator, std::ptrdiff_t Disatnce>
struct advance<Iterator const, Disatnce> struct advance<Iterator const, Disatnce>

View file

@ -9,10 +9,9 @@ namespace sprout {
// deref // deref
// //
template<typename Iterator> template<typename Iterator>
struct deref { struct deref
public: : public Iterator
typedef typename Iterator::type type; {};
};
} // namespace types } // namespace types
} // namespace sprout } // namespace sprout

View file

@ -2,6 +2,7 @@
#define SPROUT_TYPE_TRAITS_HPP #define SPROUT_TYPE_TRAITS_HPP
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/type_traits/is_convert_constructible.hpp>
#include <sprout/type_traits/is_int.hpp> #include <sprout/type_traits/is_int.hpp>
#include <sprout/type_traits/is_uint.hpp> #include <sprout/type_traits/is_uint.hpp>
#include <sprout/type_traits/is_char_type.hpp> #include <sprout/type_traits/is_char_type.hpp>

View file

@ -0,0 +1,32 @@
#ifndef SPROUT_TYPE_TRAITS_IS_CONVERT_CONSTRUCTIBLE_HPP
#define SPROUT_TYPE_TRAITS_IS_CONVERT_CONSTRUCTIBLE_HPP
#include <utility>
#include <type_traits>
#include <sprout/config.hpp>
namespace sprout {
//
// is_convert_constructible
//
namespace detail {
template<typename T>
struct is_convert_constructible_test {
public:
template<typename To = T>
static std::true_type test(To);
static std::false_type test(...);
};
} // namespace detail
template<typename T, typename Arg>
struct is_convert_constructible
: public decltype(sprout::detail::is_convert_constructible_test<T>::test(std::declval<Arg>()))
{};
#if SPROUT_USE_TEMPLATE_ALIASES
template<typename T, typename Arg>
using is_convert_constructible_ = typename sprout::is_convert_constructible<T, Arg>::type;
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
} // namespace sprout
#endif // #ifndef SPROUT_TYPE_TRAITS_IS_CONVERT_CONSTRUCTIBLE_HPP

View file

@ -13,10 +13,9 @@ namespace sprout {
// //
namespace detail { namespace detail {
template<std::size_t N, typename Head, typename... Tail> template<std::size_t N, typename Head, typename... Tail>
struct tppack_at_impl_1 { struct tppack_at_impl_1
public: : public sprout::detail::tppack_at_impl_1<N - 1, Tail...>
typedef typename sprout::detail::tppack_at_impl_1<N - 1, Tail...>::type type; {};
};
template<typename Head, typename... Tail> template<typename Head, typename... Tail>
struct tppack_at_impl_1<0, Head, Tail...> { struct tppack_at_impl_1<0, Head, Tail...> {
public: public:

View file

@ -29,11 +29,12 @@ namespace sprout {
friend class variant; friend class variant;
protected: protected:
typedef sprout::tuples::tuple<Types...> tuple_type; typedef sprout::tuples::tuple<Types...> tuple_type;
typedef sprout::types::type_tuple<typename std::decay<Types>::type...> uncvref_tuple_type; typedef sprout::types::type_tuple<typename std::decay<Types>::type...> decayed_tuple_type;
private: private:
template<typename T, sprout::index_t... Indexes> template<typename T, sprout::index_t... Indexes>
static SPROUT_CONSTEXPR tuple_type init(T&& operand, sprout::index_tuple<Indexes...>) { static SPROUT_CONSTEXPR tuple_type init(T&& operand, sprout::index_tuple<Indexes...>) {
return sprout::tuples::make<tuple_type>( return sprout::tuples::make<tuple_type>(
sprout::tuples::flexibly_construct,
typename sprout::tuples::tuple_element<Indexes, tuple_type>::type()..., typename sprout::tuples::tuple_element<Indexes, tuple_type>::type()...,
sprout::forward<T>(operand) sprout::forward<T>(operand)
); );
@ -72,28 +73,26 @@ namespace sprout {
{ {
private: private:
typedef sprout::detail::variant_impl<Types...> impl_type; typedef sprout::detail::variant_impl<Types...> impl_type;
typedef typename impl_type::uncvref_tuple_type uncvref_tuple_type; typedef typename impl_type::decayed_tuple_type decayed_tuple_type;
public: public:
typedef typename impl_type::tuple_type tuple_type; typedef typename impl_type::tuple_type tuple_type;
private: private:
template<typename Visitor, typename Tuple, typename IndexTuple> template<typename Visitor, typename Tuple, typename IndexTuple>
struct visitor_result_impl_2; struct visitor_result_impl_2;
template<typename Visitor, typename Tuple, sprout::index_t... Indexes> template<typename Visitor, typename Tuple, sprout::index_t... Indexes>
struct visitor_result_impl_2<Visitor, Tuple, sprout::index_tuple<Indexes...> > { struct visitor_result_impl_2<Visitor, Tuple, sprout::index_tuple<Indexes...> >
public: : public Visitor::template visitor_result<
typedef typename Visitor::template visitor_result<
decltype((std::declval<Visitor>())(sprout::tuples::get<Indexes>(std::declval<Tuple>())))... decltype((std::declval<Visitor>())(sprout::tuples::get<Indexes>(std::declval<Tuple>())))...
>::type type; >
}; {};
template<typename Visitor, typename Tuple, typename IndexTuple> template<typename Visitor, typename Tuple, typename IndexTuple>
struct visitor_result_impl_1; struct visitor_result_impl_1;
template<typename Visitor, typename Tuple, sprout::index_t... Indexes> template<typename Visitor, typename Tuple, sprout::index_t... Indexes>
struct visitor_result_impl_1<Visitor, Tuple, sprout::index_tuple<Indexes...> > { struct visitor_result_impl_1<Visitor, Tuple, sprout::index_tuple<Indexes...> >
public: : public sprout::common_decay<
typedef typename sprout::common_decay<
decltype((std::declval<Visitor>())(sprout::tuples::get<Indexes>(std::declval<Tuple>())))... decltype((std::declval<Visitor>())(sprout::tuples::get<Indexes>(std::declval<Tuple>())))...
>::type type; >
}; {};
template<typename Visitor, typename Tuple, typename = void> template<typename Visitor, typename Tuple, typename = void>
struct visitor_result_impl; struct visitor_result_impl;
template<typename Visitor, typename Tuple> template<typename Visitor, typename Tuple>
@ -227,7 +226,7 @@ namespace sprout {
SPROUT_CONSTEXPR variant(T&& operand) SPROUT_CONSTEXPR variant(T&& operand)
: impl_type( : impl_type(
sprout::forward<T>(operand), sprout::forward<T>(operand),
sprout::types::find_index<uncvref_tuple_type, typename std::decay<T>::type>() sprout::types::find_index<decayed_tuple_type, typename std::decay<T>::type>()
) )
{} {}
// modifiers // modifiers

View file

@ -5,7 +5,6 @@
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/string.hpp> #include <sprout/string.hpp>
#include <sprout/utility/forward.hpp> #include <sprout/utility/forward.hpp>
#include <sprout/type_traits/remove_shallow_cvref.hpp>
#include <sprout/weed/traits/type/is_c_str.hpp> #include <sprout/weed/traits/type/is_c_str.hpp>
#include <sprout/weed/traits/expr/terminal_of.hpp> #include <sprout/weed/traits/expr/terminal_of.hpp>
@ -17,7 +16,7 @@ namespace sprout {
template<typename Arg> template<typename Arg>
inline SPROUT_CONSTEXPR typename std::enable_if< inline SPROUT_CONSTEXPR typename std::enable_if<
!sprout::weed::traits::is_c_str< !sprout::weed::traits::is_c_str<
typename sprout::remove_shallow_cvref<Arg>::type typename std::remove_reference<Arg>::type
>::value, >::value,
typename sprout::weed::traits::terminal_of<Arg>::type typename sprout::weed::traits::terminal_of<Arg>::type
>::type make_terminal(Arg&& arg) { >::type make_terminal(Arg&& arg) {
@ -28,7 +27,7 @@ namespace sprout {
template<typename Arg> template<typename Arg>
inline SPROUT_CONSTEXPR typename std::enable_if< inline SPROUT_CONSTEXPR typename std::enable_if<
sprout::weed::traits::is_c_str< sprout::weed::traits::is_c_str<
typename sprout::remove_shallow_cvref<Arg>::type typename std::remove_reference<Arg>::type
>::value, >::value,
typename sprout::weed::traits::terminal_of<Arg>::type typename sprout::weed::traits::terminal_of<Arg>::type
>::type make_terminal(Arg&& arg) { >::type make_terminal(Arg&& arg) {

View file

@ -4,7 +4,6 @@
#include <type_traits> #include <type_traits>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/utility/forward.hpp> #include <sprout/utility/forward.hpp>
#include <sprout/type_traits/remove_shallow_cvref.hpp>
#include <sprout/weed/expr/make_terminal.hpp> #include <sprout/weed/expr/make_terminal.hpp>
#include <sprout/weed/traits/expr/is_expr.hpp> #include <sprout/weed/traits/expr/is_expr.hpp>
#include <sprout/weed/traits/expr/terminal_or_expr_of.hpp> #include <sprout/weed/traits/expr/terminal_or_expr_of.hpp>
@ -17,7 +16,7 @@ namespace sprout {
template<typename Arg> template<typename Arg>
inline SPROUT_CONSTEXPR typename std::enable_if< inline SPROUT_CONSTEXPR typename std::enable_if<
sprout::weed::traits::is_expr< sprout::weed::traits::is_expr<
typename sprout::remove_shallow_cvref<Arg>::type typename std::remove_reference<Arg>::type
>::value, >::value,
typename sprout::weed::traits::terminal_or_expr_of<Arg>::type typename sprout::weed::traits::terminal_or_expr_of<Arg>::type
>::type make_terminal_or_expr(Arg&& arg) { >::type make_terminal_or_expr(Arg&& arg) {
@ -26,7 +25,7 @@ namespace sprout {
template<typename Arg> template<typename Arg>
inline SPROUT_CONSTEXPR typename std::enable_if< inline SPROUT_CONSTEXPR typename std::enable_if<
!sprout::weed::traits::is_expr< !sprout::weed::traits::is_expr<
typename sprout::remove_shallow_cvref<Arg>::type typename std::remove_reference<Arg>::type
>::value, >::value,
typename sprout::weed::traits::terminal_or_expr_of<Arg>::type typename sprout::weed::traits::terminal_or_expr_of<Arg>::type
>::type make_terminal_or_expr(Arg&& arg) { >::type make_terminal_or_expr(Arg&& arg) {

View file

@ -4,7 +4,6 @@
#include <type_traits> #include <type_traits>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/utility/forward.hpp> #include <sprout/utility/forward.hpp>
#include <sprout/type_traits/remove_shallow_cvref.hpp>
#include <sprout/weed/expr/tag.hpp> #include <sprout/weed/expr/tag.hpp>
#include <sprout/weed/expr/make_expr.hpp> #include <sprout/weed/expr/make_expr.hpp>
#include <sprout/weed/traits/expr/expr_of.hpp> #include <sprout/weed/traits/expr/expr_of.hpp>
@ -19,7 +18,7 @@ namespace sprout {
typename Arg, typename Arg,
typename = typename std::enable_if< typename = typename std::enable_if<
sprout::weed::traits::is_parser< sprout::weed::traits::is_parser<
typename sprout::remove_shallow_cvref<Arg>::type typename std::remove_reference<Arg>::type
>::value >::value
>::type >::type
> >

View file

@ -4,7 +4,6 @@
#include <type_traits> #include <type_traits>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/utility/forward.hpp> #include <sprout/utility/forward.hpp>
#include <sprout/type_traits/remove_shallow_cvref.hpp>
#include <sprout/weed/expr/tag.hpp> #include <sprout/weed/expr/tag.hpp>
#include <sprout/weed/expr/make_expr.hpp> #include <sprout/weed/expr/make_expr.hpp>
#include <sprout/weed/traits/expr/expr_of.hpp> #include <sprout/weed/traits/expr/expr_of.hpp>
@ -20,10 +19,10 @@ namespace sprout {
typename Arg2, typename Arg2,
typename = typename std::enable_if< typename = typename std::enable_if<
sprout::weed::traits::is_parser< sprout::weed::traits::is_parser<
typename sprout::remove_shallow_cvref<Arg1>::type typename std::remove_reference<Arg1>::type
>::value >::value
&& sprout::weed::traits::is_parser< && sprout::weed::traits::is_parser<
typename sprout::remove_shallow_cvref<Arg2>::type typename std::remove_reference<Arg2>::type
>::value >::value
>::type >::type
> >

View file

@ -4,7 +4,6 @@
#include <type_traits> #include <type_traits>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/utility/forward.hpp> #include <sprout/utility/forward.hpp>
#include <sprout/type_traits/remove_shallow_cvref.hpp>
#include <sprout/weed/expr/tag.hpp> #include <sprout/weed/expr/tag.hpp>
#include <sprout/weed/expr/make_expr.hpp> #include <sprout/weed/expr/make_expr.hpp>
#include <sprout/weed/traits/expr/expr_of.hpp> #include <sprout/weed/traits/expr/expr_of.hpp>
@ -19,7 +18,7 @@ namespace sprout {
typename Arg, typename Arg,
typename = typename std::enable_if< typename = typename std::enable_if<
sprout::weed::traits::is_parser< sprout::weed::traits::is_parser<
typename sprout::remove_shallow_cvref<Arg>::type typename std::remove_reference<Arg>::type
>::value >::value
>::type >::type
> >

View file

@ -4,7 +4,6 @@
#include <type_traits> #include <type_traits>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/utility/forward.hpp> #include <sprout/utility/forward.hpp>
#include <sprout/type_traits/remove_shallow_cvref.hpp>
#include <sprout/weed/expr/tag.hpp> #include <sprout/weed/expr/tag.hpp>
#include <sprout/weed/expr/make_expr.hpp> #include <sprout/weed/expr/make_expr.hpp>
#include <sprout/weed/traits/expr/expr_of.hpp> #include <sprout/weed/traits/expr/expr_of.hpp>
@ -19,7 +18,7 @@ namespace sprout {
typename Arg, typename Arg,
typename = typename std::enable_if< typename = typename std::enable_if<
sprout::weed::traits::is_parser< sprout::weed::traits::is_parser<
typename sprout::remove_shallow_cvref<Arg>::type typename std::remove_reference<Arg>::type
>::value >::value
>::type >::type
> >

View file

@ -4,7 +4,6 @@
#include <type_traits> #include <type_traits>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/utility/forward.hpp> #include <sprout/utility/forward.hpp>
#include <sprout/type_traits/remove_shallow_cvref.hpp>
#include <sprout/weed/expr/tag.hpp> #include <sprout/weed/expr/tag.hpp>
#include <sprout/weed/expr/make_expr.hpp> #include <sprout/weed/expr/make_expr.hpp>
#include <sprout/weed/traits/expr/expr_of.hpp> #include <sprout/weed/traits/expr/expr_of.hpp>
@ -20,7 +19,7 @@ namespace sprout {
typename Arg2, typename Arg2,
typename = typename std::enable_if< typename = typename std::enable_if<
sprout::weed::traits::is_parser< sprout::weed::traits::is_parser<
typename sprout::remove_shallow_cvref<Arg1>::type typename std::remove_reference<Arg1>::type
>::value >::value
>::type >::type
> >

View file

@ -4,7 +4,6 @@
#include <type_traits> #include <type_traits>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/utility/forward.hpp> #include <sprout/utility/forward.hpp>
#include <sprout/type_traits/remove_shallow_cvref.hpp>
#include <sprout/weed/expr/tag.hpp> #include <sprout/weed/expr/tag.hpp>
#include <sprout/weed/expr/make_expr.hpp> #include <sprout/weed/expr/make_expr.hpp>
#include <sprout/weed/traits/expr/expr_of.hpp> #include <sprout/weed/traits/expr/expr_of.hpp>
@ -20,10 +19,10 @@ namespace sprout {
typename Arg2, typename Arg2,
typename = typename std::enable_if< typename = typename std::enable_if<
sprout::weed::traits::is_parser< sprout::weed::traits::is_parser<
typename sprout::remove_shallow_cvref<Arg1>::type typename std::remove_reference<Arg1>::type
>::value >::value
&& sprout::weed::traits::is_parser< && sprout::weed::traits::is_parser<
typename sprout::remove_shallow_cvref<Arg2>::type typename std::remove_reference<Arg2>::type
>::value >::value
>::type >::type
> >

View file

@ -4,7 +4,6 @@
#include <type_traits> #include <type_traits>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/utility/forward.hpp> #include <sprout/utility/forward.hpp>
#include <sprout/type_traits/remove_shallow_cvref.hpp>
#include <sprout/weed/expr/tag.hpp> #include <sprout/weed/expr/tag.hpp>
#include <sprout/weed/expr/make_expr.hpp> #include <sprout/weed/expr/make_expr.hpp>
#include <sprout/weed/traits/expr/expr_of.hpp> #include <sprout/weed/traits/expr/expr_of.hpp>
@ -20,10 +19,10 @@ namespace sprout {
typename Arg2, typename Arg2,
typename = typename std::enable_if< typename = typename std::enable_if<
sprout::weed::traits::is_parser< sprout::weed::traits::is_parser<
typename sprout::remove_shallow_cvref<Arg1>::type typename std::remove_reference<Arg1>::type
>::value >::value
&& sprout::weed::traits::is_parser< && sprout::weed::traits::is_parser<
typename sprout::remove_shallow_cvref<Arg2>::type typename std::remove_reference<Arg2>::type
>::value >::value
>::type >::type
> >

View file

@ -4,7 +4,6 @@
#include <type_traits> #include <type_traits>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/utility/forward.hpp> #include <sprout/utility/forward.hpp>
#include <sprout/type_traits/remove_shallow_cvref.hpp>
#include <sprout/weed/expr/tag.hpp> #include <sprout/weed/expr/tag.hpp>
#include <sprout/weed/expr/make_expr.hpp> #include <sprout/weed/expr/make_expr.hpp>
#include <sprout/weed/traits/expr/expr_of.hpp> #include <sprout/weed/traits/expr/expr_of.hpp>
@ -19,7 +18,7 @@ namespace sprout {
typename Arg, typename Arg,
typename = typename std::enable_if< typename = typename std::enable_if<
sprout::weed::traits::is_parser< sprout::weed::traits::is_parser<
typename sprout::remove_shallow_cvref<Arg>::type typename std::remove_reference<Arg>::type
>::value >::value
>::type >::type
> >

View file

@ -4,7 +4,6 @@
#include <type_traits> #include <type_traits>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/utility/forward.hpp> #include <sprout/utility/forward.hpp>
#include <sprout/type_traits/remove_shallow_cvref.hpp>
#include <sprout/weed/expr/tag.hpp> #include <sprout/weed/expr/tag.hpp>
#include <sprout/weed/expr/make_expr.hpp> #include <sprout/weed/expr/make_expr.hpp>
#include <sprout/weed/traits/expr/expr_of.hpp> #include <sprout/weed/traits/expr/expr_of.hpp>
@ -20,10 +19,10 @@ namespace sprout {
typename Arg2, typename Arg2,
typename = typename std::enable_if< typename = typename std::enable_if<
sprout::weed::traits::is_parser< sprout::weed::traits::is_parser<
typename sprout::remove_shallow_cvref<Arg1>::type typename std::remove_reference<Arg1>::type
>::value >::value
&& sprout::weed::traits::is_parser< && sprout::weed::traits::is_parser<
typename sprout::remove_shallow_cvref<Arg2>::type typename std::remove_reference<Arg2>::type
>::value >::value
>::type >::type
> >

View file

@ -4,7 +4,6 @@
#include <type_traits> #include <type_traits>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/utility/forward.hpp> #include <sprout/utility/forward.hpp>
#include <sprout/type_traits/remove_shallow_cvref.hpp>
#include <sprout/weed/expr/tag.hpp> #include <sprout/weed/expr/tag.hpp>
#include <sprout/weed/expr/make_expr.hpp> #include <sprout/weed/expr/make_expr.hpp>
#include <sprout/weed/traits/expr/expr_of.hpp> #include <sprout/weed/traits/expr/expr_of.hpp>
@ -19,7 +18,7 @@ namespace sprout {
typename Arg, typename Arg,
typename = typename std::enable_if< typename = typename std::enable_if<
sprout::weed::traits::is_parser< sprout::weed::traits::is_parser<
typename sprout::remove_shallow_cvref<Arg>::type typename std::remove_reference<Arg>::type
>::value >::value
>::type >::type
> >

View file

@ -18,7 +18,8 @@ namespace sprout {
template<typename T> template<typename T>
SPROUT_CONSTEXPR typename eval< SPROUT_CONSTEXPR typename eval<
typename sprout::remove_shallow_cvref<T>::type typename sprout::remove_shallow_cvref<T>::type
>::result_type operator()(T&& t) const { >::result_type
operator()(T&& t) const {
typedef eval<typename sprout::remove_shallow_cvref<T>::type> eval_type; typedef eval<typename sprout::remove_shallow_cvref<T>::type> eval_type;
return eval_type()(sprout::forward<T>(t)); return eval_type()(sprout::forward<T>(t));
} }

View file

@ -4,7 +4,6 @@
#include <type_traits> #include <type_traits>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/type_traits/identity.hpp> #include <sprout/type_traits/identity.hpp>
#include <sprout/type_traits/remove_shallow_cvref.hpp>
#include <sprout/weed/expr/expr_fwd.hpp> #include <sprout/weed/expr/expr_fwd.hpp>
#include <sprout/weed/traits/expr/terminal_or_expr_of.hpp> #include <sprout/weed/traits/expr/terminal_or_expr_of.hpp>
@ -20,7 +19,7 @@ namespace sprout {
sprout::weed::expr< sprout::weed::expr<
Tag, Tag,
typename sprout::weed::traits::terminal_or_expr_of< typename sprout::weed::traits::terminal_or_expr_of<
typename sprout::remove_shallow_cvref<Args>::type typename std::remove_reference<Args>::type
>::type... >::type...
> >
> >

View file

@ -23,7 +23,7 @@ namespace sprout {
Arg, Arg,
typename std::enable_if< typename std::enable_if<
!sprout::weed::traits::is_c_str< !sprout::weed::traits::is_c_str<
typename sprout::remove_shallow_cvref<Arg>::type typename std::remove_reference<Arg>::type
>::value >::value
>::type >::type
> >
@ -39,7 +39,7 @@ namespace sprout {
Arg, Arg,
typename std::enable_if< typename std::enable_if<
sprout::weed::traits::is_c_str< sprout::weed::traits::is_c_str<
typename sprout::remove_shallow_cvref<Arg>::type typename std::remove_reference<Arg>::type
>::value >::value
>::type >::type
> >
@ -47,7 +47,7 @@ namespace sprout {
sprout::weed::expr< sprout::weed::expr<
sprout::weed::tag::terminal, sprout::weed::tag::terminal,
typename sprout::weed::detail::c_str_as_string< typename sprout::weed::detail::c_str_as_string<
typename sprout::remove_shallow_cvref<Arg>::type typename std::remove_reference<Arg>::type
>::type >::type
> >
> >

View file

@ -17,7 +17,7 @@ namespace sprout {
struct terminal_or_expr_of struct terminal_or_expr_of
: public std::conditional< : public std::conditional<
sprout::weed::traits::is_expr< sprout::weed::traits::is_expr<
typename sprout::remove_shallow_cvref<Arg>::type typename std::remove_reference<Arg>::type
>::value, >::value,
sprout::remove_shallow_cvref<Arg>, sprout::remove_shallow_cvref<Arg>,
sprout::weed::traits::terminal_of<Arg> sprout::weed::traits::terminal_of<Arg>