mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-12-23 21:25:49 +00:00
fix tuple construction, darkroom rgb & vector3d construction
This commit is contained in:
parent
c78e1d0e6d
commit
2e8b85e90c
53 changed files with 262 additions and 196 deletions
|
@ -29,34 +29,44 @@ namespace testspr {
|
|||
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);
|
||||
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>(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<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));
|
||||
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::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<1>(tup3) == 1.0);
|
||||
}
|
||||
|
|
|
@ -62,9 +62,8 @@ namespace sprout {
|
|||
// join
|
||||
//
|
||||
template<typename ContainerContainer, typename Separator = void>
|
||||
struct join {
|
||||
public:
|
||||
typedef typename sprout::container_transform_traits<
|
||||
struct join
|
||||
: public sprout::container_transform_traits<
|
||||
typename sprout::container_traits<ContainerContainer>::value_type
|
||||
>::template rebind_size<
|
||||
sprout::container_traits<
|
||||
|
@ -78,20 +77,19 @@ namespace sprout {
|
|||
* sprout::container_traits<ContainerContainer>::static_size
|
||||
- sprout::algorithm::detail::string_size<Separator>::value
|
||||
: 0
|
||||
>::type type;
|
||||
};
|
||||
>
|
||||
{};
|
||||
template<typename ContainerContainer>
|
||||
struct join<ContainerContainer, void> {
|
||||
public:
|
||||
typedef typename sprout::container_transform_traits<
|
||||
struct join<ContainerContainer, void>
|
||||
: public sprout::container_transform_traits<
|
||||
typename sprout::container_traits<ContainerContainer>::value_type
|
||||
>::template rebind_size<
|
||||
sprout::container_traits<
|
||||
typename sprout::container_traits<ContainerContainer>::value_type
|
||||
>::static_size
|
||||
* sprout::container_traits<ContainerContainer>::static_size
|
||||
>::type type;
|
||||
};
|
||||
>
|
||||
{};
|
||||
} // namespace result_of
|
||||
|
||||
namespace detail {
|
||||
|
|
|
@ -11,14 +11,11 @@ namespace sprout {
|
|||
// internal
|
||||
//
|
||||
template<typename Container>
|
||||
struct internal {
|
||||
public:
|
||||
typedef typename sprout::sub_container_traits<
|
||||
struct internal
|
||||
: public sprout::sub_container_traits<
|
||||
typename std::remove_reference<Container>::type
|
||||
>::template internal<
|
||||
Container
|
||||
>::type type;
|
||||
};
|
||||
>::template internal<Container>
|
||||
{};
|
||||
} // namespace containers
|
||||
} // namespace sprout
|
||||
|
||||
|
|
|
@ -52,11 +52,26 @@ namespace sprout {
|
|||
}
|
||||
|
||||
//
|
||||
// rgb_t
|
||||
// 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
|
||||
//
|
||||
typedef sprout::tuples::tuple<std::uint8_t, std::uint8_t, std::uint8_t> rgb;
|
||||
typedef sprout::tuples::tuple<double, double, double> rgb_f;
|
||||
typedef sprout::tuples::tuple<double, double, double> rgb_f_t;
|
||||
|
||||
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
|
||||
|
|
|
@ -42,9 +42,15 @@ namespace sprout {
|
|||
}
|
||||
|
||||
//
|
||||
// vector3d_t
|
||||
// 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
|
||||
|
|
|
@ -74,8 +74,8 @@ namespace sprout {
|
|||
typedef sprout::tuples::tuple<
|
||||
bool,
|
||||
double,
|
||||
sprout::darkroom::coords::vector3d,
|
||||
sprout::darkroom::coords::vector3d,
|
||||
sprout::darkroom::coords::vector3d_t,
|
||||
sprout::darkroom::coords::vector3d_t,
|
||||
sprout::darkroom::materials::material
|
||||
> intersection;
|
||||
} // namespace intersects
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace sprout {
|
|||
//
|
||||
// basic_ambient_light
|
||||
//
|
||||
template<typename Color = sprout::darkroom::colors::rgb_f>
|
||||
template<typename Color = sprout::darkroom::colors::rgb_f_t>
|
||||
class basic_ambient_light {
|
||||
public:
|
||||
typedef Color color_type;
|
||||
|
|
|
@ -19,8 +19,8 @@ namespace sprout {
|
|||
// basic_parallel_light
|
||||
//
|
||||
template<
|
||||
typename Position = sprout::darkroom::coords::vector3d,
|
||||
typename Color = sprout::darkroom::colors::rgb_f
|
||||
typename Position = sprout::darkroom::coords::vector3d_t,
|
||||
typename Color = sprout::darkroom::colors::rgb_f_t
|
||||
>
|
||||
class basic_parallel_light {
|
||||
public:
|
||||
|
|
|
@ -19,8 +19,8 @@ namespace sprout {
|
|||
// basic_point_light
|
||||
//
|
||||
template<
|
||||
typename Position = sprout::darkroom::coords::vector3d,
|
||||
typename Color = sprout::darkroom::colors::rgb_f
|
||||
typename Position = sprout::darkroom::coords::vector3d_t,
|
||||
typename Color = sprout::darkroom::colors::rgb_f_t
|
||||
>
|
||||
class basic_point_light {
|
||||
public:
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace sprout {
|
|||
//
|
||||
// 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 darkroom
|
||||
} // namespace sprout
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace sprout {
|
|||
//
|
||||
// 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 {
|
||||
public:
|
||||
typedef Material material_type;
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace sprout {
|
|||
//
|
||||
// basic_triangle
|
||||
//
|
||||
template<typename Material, typename Vertex = sprout::darkroom::coords::vector3d>
|
||||
template<typename Material, typename Vertex = sprout::darkroom::coords::vector3d_t>
|
||||
class basic_triangle {
|
||||
public:
|
||||
typedef Material material_type;
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace sprout {
|
|||
//
|
||||
// basic_sphere
|
||||
//
|
||||
template<typename Material, typename Position = sprout::darkroom::coords::vector3d>
|
||||
template<typename Material, typename Position = sprout::darkroom::coords::vector3d_t>
|
||||
class basic_sphere {
|
||||
public:
|
||||
typedef Material material_type;
|
||||
|
|
|
@ -125,7 +125,7 @@ namespace sprout {
|
|||
//
|
||||
// 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 {
|
||||
public:
|
||||
typedef sprout::array<sprout::array<Color, Width>, Height> type;
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace sprout {
|
|||
//
|
||||
// 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
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace sprout {
|
|||
//
|
||||
// uniform_color
|
||||
//
|
||||
template<typename Color = sprout::darkroom::colors::rgb_f>
|
||||
template<typename Color = sprout::darkroom::colors::rgb_f_t>
|
||||
class uniform_color {
|
||||
public:
|
||||
typedef Color color_type;
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace sprout {
|
|||
//
|
||||
// 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 {
|
||||
public:
|
||||
typedef Color color_type;
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace sprout {
|
|||
//
|
||||
// raytracer
|
||||
//
|
||||
template<typename Color = sprout::darkroom::colors::rgb_f>
|
||||
template<typename Color = sprout::darkroom::colors::rgb_f_t>
|
||||
class raytracer {
|
||||
public:
|
||||
typedef Color color_type;
|
||||
|
|
|
@ -14,14 +14,13 @@ namespace sprout {
|
|||
// append
|
||||
//
|
||||
template<typename Container, typename Input>
|
||||
struct append {
|
||||
public:
|
||||
typedef typename sprout::container_transform_traits<
|
||||
struct append
|
||||
: public sprout::container_transform_traits<
|
||||
Container
|
||||
>::template rebind_size<
|
||||
sprout::container_traits<Container>::static_size + sprout::container_traits<Input>::static_size
|
||||
>::type type;
|
||||
};
|
||||
>
|
||||
{};
|
||||
} // namespace result_of
|
||||
|
||||
namespace detail {
|
||||
|
|
|
@ -14,14 +14,14 @@ namespace sprout {
|
|||
// erase
|
||||
//
|
||||
template<typename Container>
|
||||
struct erase {
|
||||
static_assert(sprout::container_traits<Container>::static_size >= 1, "static_size >= 1");
|
||||
public:
|
||||
typedef typename sprout::container_transform_traits<
|
||||
struct erase
|
||||
: public sprout::container_transform_traits<
|
||||
Container
|
||||
>::template rebind_size<
|
||||
sprout::container_traits<Container>::static_size - 1
|
||||
>::type type;
|
||||
>
|
||||
{
|
||||
static_assert(sprout::container_traits<Container>::static_size >= 1, "static_size >= 1");
|
||||
};
|
||||
} // namespace result_of
|
||||
|
||||
|
|
|
@ -15,14 +15,14 @@ namespace sprout {
|
|||
// erase_n
|
||||
//
|
||||
template<std::size_t N, typename Container>
|
||||
struct erase_n {
|
||||
static_assert(sprout::container_traits<Container>::static_size >= N, "static_size >= N");
|
||||
public:
|
||||
typedef typename sprout::container_transform_traits<
|
||||
struct erase_n
|
||||
: public sprout::container_transform_traits<
|
||||
Container
|
||||
>::template rebind_size<
|
||||
sprout::container_traits<Container>::static_size - N
|
||||
>::type type;
|
||||
>
|
||||
{
|
||||
static_assert(sprout::container_traits<Container>::static_size >= N, "static_size >= N");
|
||||
};
|
||||
} // namespace result_of
|
||||
|
||||
|
|
|
@ -16,14 +16,13 @@ namespace sprout {
|
|||
// insert
|
||||
//
|
||||
template<typename Container, typename T, typename... Values>
|
||||
struct insert {
|
||||
public:
|
||||
typedef typename sprout::container_transform_traits<
|
||||
struct insert
|
||||
: public sprout::container_transform_traits<
|
||||
Container
|
||||
>::template rebind_size<
|
||||
sprout::container_traits<Container>::static_size + 1 + sizeof...(Values)
|
||||
>::type type;
|
||||
};
|
||||
>
|
||||
{};
|
||||
} // namespace result_of
|
||||
|
||||
namespace detail {
|
||||
|
|
|
@ -18,14 +18,13 @@ namespace sprout {
|
|||
// insert_n
|
||||
//
|
||||
template<std::size_t N, typename Container, typename T, typename... Values>
|
||||
struct insert_n {
|
||||
public:
|
||||
typedef typename sprout::container_transform_traits<
|
||||
struct insert_n
|
||||
: public sprout::container_transform_traits<
|
||||
Container
|
||||
>::template rebind_size<
|
||||
sprout::container_traits<Container>::static_size + (1 + sizeof...(Values)) * N
|
||||
>::type type;
|
||||
};
|
||||
>
|
||||
{};
|
||||
} // namespace result_of
|
||||
|
||||
namespace detail {
|
||||
|
|
|
@ -15,14 +15,13 @@ namespace sprout {
|
|||
// resize
|
||||
//
|
||||
template<std::size_t N, typename Container>
|
||||
struct resize {
|
||||
public:
|
||||
typedef typename sprout::container_transform_traits<
|
||||
struct resize
|
||||
: public sprout::container_transform_traits<
|
||||
Container
|
||||
>::template rebind_size<
|
||||
N
|
||||
>::type type;
|
||||
};
|
||||
>
|
||||
{};
|
||||
} // namespace result_of
|
||||
|
||||
namespace detail {
|
||||
|
|
|
@ -132,40 +132,35 @@ namespace sprout {
|
|||
};
|
||||
|
||||
template<typename LRange, typename RRange, typename = void>
|
||||
class jointed_range_copied_type;
|
||||
|
||||
struct jointed_range_copied_type;
|
||||
template<typename LRange, typename RRange>
|
||||
class jointed_range_copied_type<
|
||||
struct jointed_range_copied_type<
|
||||
LRange, RRange,
|
||||
typename std::enable_if<
|
||||
sprout::containers::is_rebindable_size<LRange>::value
|
||||
>::type
|
||||
> {
|
||||
public:
|
||||
typedef typename sprout::container_construct_traits<
|
||||
>
|
||||
: public sprout::container_construct_traits<
|
||||
typename sprout::containers::weak_rebind_size<
|
||||
typename sprout::container_construct_traits<LRange>::copied_type,
|
||||
sprout::adaptors::detail::jointed_range_size<LRange, RRange>::static_size
|
||||
>::type
|
||||
>::type copied_type;
|
||||
};
|
||||
|
||||
>
|
||||
{};
|
||||
template<typename LRange, typename RRange>
|
||||
class jointed_range_copied_type<
|
||||
struct jointed_range_copied_type<
|
||||
LRange, RRange,
|
||||
typename std::enable_if<
|
||||
!sprout::containers::is_rebindable_size<LRange>::value && sprout::containers::is_rebindable_size<RRange>::value
|
||||
>::type
|
||||
> {
|
||||
public:
|
||||
typedef typename sprout::containers::weak_rebind_size<
|
||||
>
|
||||
: public sprout::containers::weak_rebind_size<
|
||||
typename sprout::container_construct_traits<RRange>::copied_type,
|
||||
sprout::adaptors::detail::jointed_range_size<LRange, RRange>::static_size
|
||||
>::type type;
|
||||
};
|
||||
|
||||
>
|
||||
{};
|
||||
template<typename LRange, typename RRange>
|
||||
class jointed_range_copied_type<
|
||||
struct jointed_range_copied_type<
|
||||
LRange, RRange,
|
||||
typename std::enable_if<
|
||||
!sprout::containers::is_rebindable_size<LRange>::value && !sprout::containers::is_rebindable_size<RRange>::value
|
||||
|
|
|
@ -46,14 +46,13 @@ namespace sprout {
|
|||
template<typename Tuple, typename IndexTuple>
|
||||
struct default_copied;
|
||||
template<typename Tuple, sprout::index_t... Indexes>
|
||||
struct default_copied<Tuple, sprout::index_tuple<Indexes...> > {
|
||||
public:
|
||||
typedef typename sprout::tuples::rebind_types<Tuple>::template apply<
|
||||
struct default_copied<Tuple, sprout::index_tuple<Indexes...> >
|
||||
: public sprout::tuples::rebind_types<Tuple>::template apply<
|
||||
typename std::decay<
|
||||
typename sprout::tuples::tuple_element<Indexes, Tuple>::type
|
||||
>::type...
|
||||
>::type type;
|
||||
};
|
||||
>
|
||||
{};
|
||||
|
||||
template<typename Tuple, typename... Args>
|
||||
SPROUT_CONSTEXPR typename sprout::tuples::tuple_construct_traits<Tuple>::copied_type
|
||||
|
|
|
@ -10,5 +10,6 @@
|
|||
#include <sprout/tuple/tuple/ignore.hpp>
|
||||
#include <sprout/tuple/tuple/make_tuple.hpp>
|
||||
#include <sprout/tuple/tuple/type_traits.hpp>
|
||||
#include <sprout/tuple/tuple/flexibly_construct.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_TUPLE_TUPLE_HPP
|
||||
|
|
20
sprout/tuple/tuple/flexibly_construct.hpp
Normal file
20
sprout/tuple/tuple/flexibly_construct.hpp
Normal 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
|
|
@ -40,26 +40,23 @@ namespace sprout {
|
|||
: public std::tuple_element<I, T>
|
||||
{};
|
||||
template<std::size_t I, typename T>
|
||||
struct tuple_element<I, T const> {
|
||||
public:
|
||||
typedef typename std::add_const<
|
||||
struct tuple_element<I, T const>
|
||||
: public std::add_const<
|
||||
typename sprout::tuples::tuple_element<I, T>::type
|
||||
>::type type;
|
||||
};
|
||||
>
|
||||
{};
|
||||
template<std::size_t I, typename T>
|
||||
struct tuple_element<I, T volatile> {
|
||||
public:
|
||||
typedef typename std::add_volatile<
|
||||
struct tuple_element<I, T volatile>
|
||||
: public std::add_volatile<
|
||||
typename sprout::tuples::tuple_element<I, T>::type
|
||||
>::type type;
|
||||
};
|
||||
>
|
||||
{};
|
||||
template<std::size_t I, typename T>
|
||||
struct tuple_element<I, T const volatile> {
|
||||
public:
|
||||
typedef typename std::add_cv<
|
||||
struct tuple_element<I, T const volatile>
|
||||
: public std::add_cv<
|
||||
typename sprout::tuples::tuple_element<I, T>::type
|
||||
>::type type;
|
||||
};
|
||||
>
|
||||
{};
|
||||
|
||||
namespace detail {
|
||||
template<std::size_t I, typename Head, typename... Tail>
|
||||
|
|
|
@ -103,12 +103,11 @@ namespace sprout {
|
|||
typedef sprout::index_tuple<> type;
|
||||
};
|
||||
template<typename Head, typename... Tail>
|
||||
struct tuple_cat_1st_indexes<Head, Tail...> {
|
||||
public:
|
||||
typedef typename sprout::index_range<
|
||||
struct tuple_cat_1st_indexes<Head, Tail...>
|
||||
: public sprout::index_range<
|
||||
0, sprout::tuples::tuple_size<typename std::remove_reference<Head>::type>::value
|
||||
>::type type;
|
||||
};
|
||||
>
|
||||
{};
|
||||
|
||||
template<typename Result, typename IndexTuple, typename... Tuples>
|
||||
struct tuple_cat_impl;
|
||||
|
|
|
@ -9,8 +9,10 @@
|
|||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/utility/move.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/type_traits.hpp>
|
||||
#include <sprout/tuple/tuple/flexibly_construct.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace tuples {
|
||||
|
@ -247,32 +249,46 @@ namespace sprout {
|
|||
: inherited_type(elements...)
|
||||
{}
|
||||
template<
|
||||
typename U,
|
||||
typename... UTypes,
|
||||
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
|
||||
>
|
||||
explicit SPROUT_CONSTEXPR tuple(U&& elem)
|
||||
: inherited_type(sprout::forward<U>(elem))
|
||||
explicit SPROUT_CONSTEXPR tuple(UTypes&&... elements)
|
||||
: inherited_type(sprout::forward<UTypes>(elements)...)
|
||||
{}
|
||||
template<
|
||||
typename U1,
|
||||
typename U2,
|
||||
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)...)
|
||||
template<typename... UTypes>
|
||||
explicit SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, UTypes&&... elements)
|
||||
: inherited_type(sprout::forward<UTypes>(elements)...)
|
||||
{}
|
||||
SPROUT_CONSTEXPR tuple(tuple const&) = 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)
|
||||
: 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)
|
||||
: 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& operator=(tuple const& rhs) {
|
||||
static_cast<inherited_type&>(*this) = rhs;
|
||||
|
|
|
@ -9,10 +9,9 @@ namespace sprout {
|
|||
// advance
|
||||
//
|
||||
template<typename Iterator, std::ptrdiff_t Disatnce, typename Enable = void>
|
||||
struct advance {
|
||||
public:
|
||||
typedef typename Iterator::template advance<Disatnce>::type type;
|
||||
};
|
||||
struct advance
|
||||
: public Iterator::template advance<Disatnce>
|
||||
{};
|
||||
|
||||
template<typename Iterator, std::ptrdiff_t Disatnce>
|
||||
struct advance<Iterator const, Disatnce>
|
||||
|
|
|
@ -9,10 +9,9 @@ namespace sprout {
|
|||
// deref
|
||||
//
|
||||
template<typename Iterator>
|
||||
struct deref {
|
||||
public:
|
||||
typedef typename Iterator::type type;
|
||||
};
|
||||
struct deref
|
||||
: public Iterator
|
||||
{};
|
||||
} // namespace types
|
||||
} // namespace sprout
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define SPROUT_TYPE_TRAITS_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_uint.hpp>
|
||||
#include <sprout/type_traits/is_char_type.hpp>
|
||||
|
|
32
sprout/type_traits/is_convert_constructible.hpp
Normal file
32
sprout/type_traits/is_convert_constructible.hpp
Normal 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
|
|
@ -13,10 +13,9 @@ namespace sprout {
|
|||
//
|
||||
namespace detail {
|
||||
template<std::size_t N, typename Head, typename... Tail>
|
||||
struct tppack_at_impl_1 {
|
||||
public:
|
||||
typedef typename sprout::detail::tppack_at_impl_1<N - 1, Tail...>::type type;
|
||||
};
|
||||
struct tppack_at_impl_1
|
||||
: public sprout::detail::tppack_at_impl_1<N - 1, Tail...>
|
||||
{};
|
||||
template<typename Head, typename... Tail>
|
||||
struct tppack_at_impl_1<0, Head, Tail...> {
|
||||
public:
|
||||
|
|
|
@ -29,11 +29,12 @@ namespace sprout {
|
|||
friend class variant;
|
||||
protected:
|
||||
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:
|
||||
template<typename T, sprout::index_t... Indexes>
|
||||
static SPROUT_CONSTEXPR tuple_type init(T&& operand, sprout::index_tuple<Indexes...>) {
|
||||
return sprout::tuples::make<tuple_type>(
|
||||
sprout::tuples::flexibly_construct,
|
||||
typename sprout::tuples::tuple_element<Indexes, tuple_type>::type()...,
|
||||
sprout::forward<T>(operand)
|
||||
);
|
||||
|
@ -72,28 +73,26 @@ namespace sprout {
|
|||
{
|
||||
private:
|
||||
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:
|
||||
typedef typename impl_type::tuple_type tuple_type;
|
||||
private:
|
||||
template<typename Visitor, typename Tuple, typename IndexTuple>
|
||||
struct visitor_result_impl_2;
|
||||
template<typename Visitor, typename Tuple, sprout::index_t... Indexes>
|
||||
struct visitor_result_impl_2<Visitor, Tuple, sprout::index_tuple<Indexes...> > {
|
||||
public:
|
||||
typedef typename Visitor::template visitor_result<
|
||||
struct visitor_result_impl_2<Visitor, Tuple, sprout::index_tuple<Indexes...> >
|
||||
: public Visitor::template visitor_result<
|
||||
decltype((std::declval<Visitor>())(sprout::tuples::get<Indexes>(std::declval<Tuple>())))...
|
||||
>::type type;
|
||||
};
|
||||
>
|
||||
{};
|
||||
template<typename Visitor, typename Tuple, typename IndexTuple>
|
||||
struct visitor_result_impl_1;
|
||||
template<typename Visitor, typename Tuple, sprout::index_t... Indexes>
|
||||
struct visitor_result_impl_1<Visitor, Tuple, sprout::index_tuple<Indexes...> > {
|
||||
public:
|
||||
typedef typename sprout::common_decay<
|
||||
struct visitor_result_impl_1<Visitor, Tuple, sprout::index_tuple<Indexes...> >
|
||||
: public sprout::common_decay<
|
||||
decltype((std::declval<Visitor>())(sprout::tuples::get<Indexes>(std::declval<Tuple>())))...
|
||||
>::type type;
|
||||
};
|
||||
>
|
||||
{};
|
||||
template<typename Visitor, typename Tuple, typename = void>
|
||||
struct visitor_result_impl;
|
||||
template<typename Visitor, typename Tuple>
|
||||
|
@ -227,7 +226,7 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR variant(T&& operand)
|
||||
: impl_type(
|
||||
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
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/string.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/expr/terminal_of.hpp>
|
||||
|
||||
|
@ -17,7 +16,7 @@ namespace sprout {
|
|||
template<typename Arg>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
!sprout::weed::traits::is_c_str<
|
||||
typename sprout::remove_shallow_cvref<Arg>::type
|
||||
typename std::remove_reference<Arg>::type
|
||||
>::value,
|
||||
typename sprout::weed::traits::terminal_of<Arg>::type
|
||||
>::type make_terminal(Arg&& arg) {
|
||||
|
@ -28,7 +27,7 @@ namespace sprout {
|
|||
template<typename Arg>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::weed::traits::is_c_str<
|
||||
typename sprout::remove_shallow_cvref<Arg>::type
|
||||
typename std::remove_reference<Arg>::type
|
||||
>::value,
|
||||
typename sprout::weed::traits::terminal_of<Arg>::type
|
||||
>::type make_terminal(Arg&& arg) {
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/type_traits/remove_shallow_cvref.hpp>
|
||||
#include <sprout/weed/expr/make_terminal.hpp>
|
||||
#include <sprout/weed/traits/expr/is_expr.hpp>
|
||||
#include <sprout/weed/traits/expr/terminal_or_expr_of.hpp>
|
||||
|
@ -17,7 +16,7 @@ namespace sprout {
|
|||
template<typename Arg>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::weed::traits::is_expr<
|
||||
typename sprout::remove_shallow_cvref<Arg>::type
|
||||
typename std::remove_reference<Arg>::type
|
||||
>::value,
|
||||
typename sprout::weed::traits::terminal_or_expr_of<Arg>::type
|
||||
>::type make_terminal_or_expr(Arg&& arg) {
|
||||
|
@ -26,7 +25,7 @@ namespace sprout {
|
|||
template<typename Arg>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
!sprout::weed::traits::is_expr<
|
||||
typename sprout::remove_shallow_cvref<Arg>::type
|
||||
typename std::remove_reference<Arg>::type
|
||||
>::value,
|
||||
typename sprout::weed::traits::terminal_or_expr_of<Arg>::type
|
||||
>::type make_terminal_or_expr(Arg&& arg) {
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/type_traits/remove_shallow_cvref.hpp>
|
||||
#include <sprout/weed/expr/tag.hpp>
|
||||
#include <sprout/weed/expr/make_expr.hpp>
|
||||
#include <sprout/weed/traits/expr/expr_of.hpp>
|
||||
|
@ -19,7 +18,7 @@ namespace sprout {
|
|||
typename Arg,
|
||||
typename = typename std::enable_if<
|
||||
sprout::weed::traits::is_parser<
|
||||
typename sprout::remove_shallow_cvref<Arg>::type
|
||||
typename std::remove_reference<Arg>::type
|
||||
>::value
|
||||
>::type
|
||||
>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/type_traits/remove_shallow_cvref.hpp>
|
||||
#include <sprout/weed/expr/tag.hpp>
|
||||
#include <sprout/weed/expr/make_expr.hpp>
|
||||
#include <sprout/weed/traits/expr/expr_of.hpp>
|
||||
|
@ -20,10 +19,10 @@ namespace sprout {
|
|||
typename Arg2,
|
||||
typename = typename std::enable_if<
|
||||
sprout::weed::traits::is_parser<
|
||||
typename sprout::remove_shallow_cvref<Arg1>::type
|
||||
typename std::remove_reference<Arg1>::type
|
||||
>::value
|
||||
&& sprout::weed::traits::is_parser<
|
||||
typename sprout::remove_shallow_cvref<Arg2>::type
|
||||
typename std::remove_reference<Arg2>::type
|
||||
>::value
|
||||
>::type
|
||||
>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/type_traits/remove_shallow_cvref.hpp>
|
||||
#include <sprout/weed/expr/tag.hpp>
|
||||
#include <sprout/weed/expr/make_expr.hpp>
|
||||
#include <sprout/weed/traits/expr/expr_of.hpp>
|
||||
|
@ -19,7 +18,7 @@ namespace sprout {
|
|||
typename Arg,
|
||||
typename = typename std::enable_if<
|
||||
sprout::weed::traits::is_parser<
|
||||
typename sprout::remove_shallow_cvref<Arg>::type
|
||||
typename std::remove_reference<Arg>::type
|
||||
>::value
|
||||
>::type
|
||||
>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/type_traits/remove_shallow_cvref.hpp>
|
||||
#include <sprout/weed/expr/tag.hpp>
|
||||
#include <sprout/weed/expr/make_expr.hpp>
|
||||
#include <sprout/weed/traits/expr/expr_of.hpp>
|
||||
|
@ -19,7 +18,7 @@ namespace sprout {
|
|||
typename Arg,
|
||||
typename = typename std::enable_if<
|
||||
sprout::weed::traits::is_parser<
|
||||
typename sprout::remove_shallow_cvref<Arg>::type
|
||||
typename std::remove_reference<Arg>::type
|
||||
>::value
|
||||
>::type
|
||||
>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/type_traits/remove_shallow_cvref.hpp>
|
||||
#include <sprout/weed/expr/tag.hpp>
|
||||
#include <sprout/weed/expr/make_expr.hpp>
|
||||
#include <sprout/weed/traits/expr/expr_of.hpp>
|
||||
|
@ -20,7 +19,7 @@ namespace sprout {
|
|||
typename Arg2,
|
||||
typename = typename std::enable_if<
|
||||
sprout::weed::traits::is_parser<
|
||||
typename sprout::remove_shallow_cvref<Arg1>::type
|
||||
typename std::remove_reference<Arg1>::type
|
||||
>::value
|
||||
>::type
|
||||
>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/type_traits/remove_shallow_cvref.hpp>
|
||||
#include <sprout/weed/expr/tag.hpp>
|
||||
#include <sprout/weed/expr/make_expr.hpp>
|
||||
#include <sprout/weed/traits/expr/expr_of.hpp>
|
||||
|
@ -20,10 +19,10 @@ namespace sprout {
|
|||
typename Arg2,
|
||||
typename = typename std::enable_if<
|
||||
sprout::weed::traits::is_parser<
|
||||
typename sprout::remove_shallow_cvref<Arg1>::type
|
||||
typename std::remove_reference<Arg1>::type
|
||||
>::value
|
||||
&& sprout::weed::traits::is_parser<
|
||||
typename sprout::remove_shallow_cvref<Arg2>::type
|
||||
typename std::remove_reference<Arg2>::type
|
||||
>::value
|
||||
>::type
|
||||
>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/type_traits/remove_shallow_cvref.hpp>
|
||||
#include <sprout/weed/expr/tag.hpp>
|
||||
#include <sprout/weed/expr/make_expr.hpp>
|
||||
#include <sprout/weed/traits/expr/expr_of.hpp>
|
||||
|
@ -20,10 +19,10 @@ namespace sprout {
|
|||
typename Arg2,
|
||||
typename = typename std::enable_if<
|
||||
sprout::weed::traits::is_parser<
|
||||
typename sprout::remove_shallow_cvref<Arg1>::type
|
||||
typename std::remove_reference<Arg1>::type
|
||||
>::value
|
||||
&& sprout::weed::traits::is_parser<
|
||||
typename sprout::remove_shallow_cvref<Arg2>::type
|
||||
typename std::remove_reference<Arg2>::type
|
||||
>::value
|
||||
>::type
|
||||
>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/type_traits/remove_shallow_cvref.hpp>
|
||||
#include <sprout/weed/expr/tag.hpp>
|
||||
#include <sprout/weed/expr/make_expr.hpp>
|
||||
#include <sprout/weed/traits/expr/expr_of.hpp>
|
||||
|
@ -19,7 +18,7 @@ namespace sprout {
|
|||
typename Arg,
|
||||
typename = typename std::enable_if<
|
||||
sprout::weed::traits::is_parser<
|
||||
typename sprout::remove_shallow_cvref<Arg>::type
|
||||
typename std::remove_reference<Arg>::type
|
||||
>::value
|
||||
>::type
|
||||
>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/type_traits/remove_shallow_cvref.hpp>
|
||||
#include <sprout/weed/expr/tag.hpp>
|
||||
#include <sprout/weed/expr/make_expr.hpp>
|
||||
#include <sprout/weed/traits/expr/expr_of.hpp>
|
||||
|
@ -20,10 +19,10 @@ namespace sprout {
|
|||
typename Arg2,
|
||||
typename = typename std::enable_if<
|
||||
sprout::weed::traits::is_parser<
|
||||
typename sprout::remove_shallow_cvref<Arg1>::type
|
||||
typename std::remove_reference<Arg1>::type
|
||||
>::value
|
||||
&& sprout::weed::traits::is_parser<
|
||||
typename sprout::remove_shallow_cvref<Arg2>::type
|
||||
typename std::remove_reference<Arg2>::type
|
||||
>::value
|
||||
>::type
|
||||
>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/type_traits/remove_shallow_cvref.hpp>
|
||||
#include <sprout/weed/expr/tag.hpp>
|
||||
#include <sprout/weed/expr/make_expr.hpp>
|
||||
#include <sprout/weed/traits/expr/expr_of.hpp>
|
||||
|
@ -19,7 +18,7 @@ namespace sprout {
|
|||
typename Arg,
|
||||
typename = typename std::enable_if<
|
||||
sprout::weed::traits::is_parser<
|
||||
typename sprout::remove_shallow_cvref<Arg>::type
|
||||
typename std::remove_reference<Arg>::type
|
||||
>::value
|
||||
>::type
|
||||
>
|
||||
|
|
|
@ -18,7 +18,8 @@ namespace sprout {
|
|||
template<typename T>
|
||||
SPROUT_CONSTEXPR typename eval<
|
||||
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;
|
||||
return eval_type()(sprout::forward<T>(t));
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <type_traits>
|
||||
#include <sprout/config.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/traits/expr/terminal_or_expr_of.hpp>
|
||||
|
||||
|
@ -20,7 +19,7 @@ namespace sprout {
|
|||
sprout::weed::expr<
|
||||
Tag,
|
||||
typename sprout::weed::traits::terminal_or_expr_of<
|
||||
typename sprout::remove_shallow_cvref<Args>::type
|
||||
typename std::remove_reference<Args>::type
|
||||
>::type...
|
||||
>
|
||||
>
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace sprout {
|
|||
Arg,
|
||||
typename std::enable_if<
|
||||
!sprout::weed::traits::is_c_str<
|
||||
typename sprout::remove_shallow_cvref<Arg>::type
|
||||
typename std::remove_reference<Arg>::type
|
||||
>::value
|
||||
>::type
|
||||
>
|
||||
|
@ -39,7 +39,7 @@ namespace sprout {
|
|||
Arg,
|
||||
typename std::enable_if<
|
||||
sprout::weed::traits::is_c_str<
|
||||
typename sprout::remove_shallow_cvref<Arg>::type
|
||||
typename std::remove_reference<Arg>::type
|
||||
>::value
|
||||
>::type
|
||||
>
|
||||
|
@ -47,7 +47,7 @@ namespace sprout {
|
|||
sprout::weed::expr<
|
||||
sprout::weed::tag::terminal,
|
||||
typename sprout::weed::detail::c_str_as_string<
|
||||
typename sprout::remove_shallow_cvref<Arg>::type
|
||||
typename std::remove_reference<Arg>::type
|
||||
>::type
|
||||
>
|
||||
>
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace sprout {
|
|||
struct terminal_or_expr_of
|
||||
: public std::conditional<
|
||||
sprout::weed::traits::is_expr<
|
||||
typename sprout::remove_shallow_cvref<Arg>::type
|
||||
typename std::remove_reference<Arg>::type
|
||||
>::value,
|
||||
sprout::remove_shallow_cvref<Arg>,
|
||||
sprout::weed::traits::terminal_of<Arg>
|
||||
|
|
Loading…
Reference in a new issue