mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
sprout/weed.hpp 追加
This commit is contained in:
parent
8103682fdb
commit
ecfc2b297a
96 changed files with 5127 additions and 0 deletions
11
sprout/weed/traits/expr.hpp
Normal file
11
sprout/weed/traits/expr.hpp
Normal file
|
@ -0,0 +1,11 @@
|
|||
#ifndef SPROUT_WEED_TRAITS_EXPR_HPP
|
||||
#define SPROUT_WEED_TRAITS_EXPR_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/weed/traits/expr/is_expr.hpp>
|
||||
#include <sprout/weed/traits/expr/tag_of.hpp>
|
||||
#include <sprout/weed/traits/expr/terminal_of.hpp>
|
||||
#include <sprout/weed/traits/expr/terminal_or_expr_of.hpp>
|
||||
#include <sprout/weed/traits/expr/expr_of.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_WEED_TRAITS_EXPR_HPP
|
30
sprout/weed/traits/expr/expr_of.hpp
Normal file
30
sprout/weed/traits/expr/expr_of.hpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
#ifndef SPROUT_WEED_TRAITS_EXPR_EXPR_OF_HPP
|
||||
#define SPROUT_WEED_TRAITS_EXPR_EXPR_OF_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/weed/expr/expr.hpp>
|
||||
#include <sprout/weed/traits/expr/terminal_or_expr_of.hpp>
|
||||
#include <sprout/weed/detail/uncvref.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace weed {
|
||||
namespace traits {
|
||||
//
|
||||
// expr_of
|
||||
//
|
||||
template<typename Tag, typename... Args>
|
||||
struct expr_of {
|
||||
public:
|
||||
typedef sprout::weed::expr<
|
||||
Tag,
|
||||
typename sprout::weed::traits::terminal_or_expr_of<
|
||||
typename sprout::weed::detail::uncvref<Args>::type
|
||||
>::type...
|
||||
> type;
|
||||
};
|
||||
} // namespace traits
|
||||
} // namespace weed
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_WEED_TRAITS_EXPR_EXPR_OF_HPP
|
30
sprout/weed/traits/expr/is_expr.hpp
Normal file
30
sprout/weed/traits/expr/is_expr.hpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
#ifndef SPROUT_WEED_TRAITS_EXPR_IS_EXPR_HPP
|
||||
#define SPROUT_WEED_TRAITS_EXPR_IS_EXPR_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/weed/expr/expr.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace weed {
|
||||
namespace traits {
|
||||
//
|
||||
// is_expr
|
||||
//
|
||||
template<typename T>
|
||||
struct is_expr
|
||||
: public std::false_type
|
||||
{};
|
||||
template<typename T>
|
||||
struct is_expr<T const>
|
||||
: public sprout::weed::traits::is_expr<T>
|
||||
{};
|
||||
template<typename Tag, typename... Args>
|
||||
struct is_expr<sprout::weed::expr<Tag, Args...> >
|
||||
: public std::true_type
|
||||
{};
|
||||
} // namespace traits
|
||||
} // namespace weed
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_WEED_TRAITS_EXPR_IS_EXPR_HPP
|
34
sprout/weed/traits/expr/tag_of.hpp
Normal file
34
sprout/weed/traits/expr/tag_of.hpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
#ifndef SPROUT_WEED_TRAITS_EXPR_TAG_OF_HPP
|
||||
#define SPROUT_WEED_TRAITS_EXPR_TAG_OF_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/weed/traits/expr/is_expr.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace weed {
|
||||
namespace traits {
|
||||
//
|
||||
// tag_of
|
||||
//
|
||||
template<typename Expr, typename = void>
|
||||
struct tag_of;
|
||||
template<typename Expr>
|
||||
struct tag_of<Expr const>
|
||||
: public sprout::weed::traits::tag_of<Expr>
|
||||
{};
|
||||
template<typename Expr>
|
||||
struct tag_of<
|
||||
Expr,
|
||||
typename std::enable_if<
|
||||
sprout::weed::traits::is_expr<Expr>::value
|
||||
>::type
|
||||
> {
|
||||
public:
|
||||
typedef typename Expr::expr_tag type;
|
||||
};
|
||||
} // namespace traits
|
||||
} // namespace weed
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_WEED_TRAITS_EXPR_TAG_OF_HPP
|
56
sprout/weed/traits/expr/terminal_of.hpp
Normal file
56
sprout/weed/traits/expr/terminal_of.hpp
Normal file
|
@ -0,0 +1,56 @@
|
|||
#ifndef SPROUT_WEED_TRAITS_EXPR_TERMINAL_OF_HPP
|
||||
#define SPROUT_WEED_TRAITS_EXPR_TERMINAL_OF_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/weed/expr/expr.hpp>
|
||||
#include <sprout/weed/expr/tag.hpp>
|
||||
#include <sprout/weed/traits/type/is_c_str.hpp>
|
||||
#include <sprout/weed/detail/uncvref.hpp>
|
||||
#include <sprout/weed/detail/c_str_as_string.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace weed {
|
||||
namespace traits {
|
||||
//
|
||||
// terminal_of
|
||||
//
|
||||
template<typename Arg, typename = void>
|
||||
struct terminal_of;
|
||||
template<typename Arg>
|
||||
struct terminal_of<
|
||||
Arg,
|
||||
typename std::enable_if<
|
||||
!sprout::weed::traits::is_c_str<
|
||||
typename sprout::weed::detail::uncvref<Arg>::type
|
||||
>::value
|
||||
>::type
|
||||
> {
|
||||
public:
|
||||
typedef sprout::weed::expr<
|
||||
sprout::weed::tag::terminal,
|
||||
typename sprout::weed::detail::uncvref<Arg>::type
|
||||
> type;
|
||||
};
|
||||
template<typename Arg>
|
||||
struct terminal_of<
|
||||
Arg,
|
||||
typename std::enable_if<
|
||||
sprout::weed::traits::is_c_str<
|
||||
typename sprout::weed::detail::uncvref<Arg>::type
|
||||
>::value
|
||||
>::type
|
||||
> {
|
||||
public:
|
||||
typedef sprout::weed::expr<
|
||||
sprout::weed::tag::terminal,
|
||||
typename sprout::weed::detail::c_str_as_string<
|
||||
typename sprout::weed::detail::uncvref<Arg>::type
|
||||
>::type
|
||||
> type;
|
||||
};
|
||||
} // namespace traits
|
||||
} // namespace weed
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_WEED_TRAITS_EXPR_TERMINAL_OF_HPP
|
31
sprout/weed/traits/expr/terminal_or_expr_of.hpp
Normal file
31
sprout/weed/traits/expr/terminal_or_expr_of.hpp
Normal file
|
@ -0,0 +1,31 @@
|
|||
#ifndef SPROUT_WEED_TRAITS_EXPR_TERMINAL_OR_EXPR_OF_HPP
|
||||
#define SPROUT_WEED_TRAITS_EXPR_TERMINAL_OR_EXPR_OF_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/weed/traits/expr/is_expr.hpp>
|
||||
#include <sprout/weed/traits/expr/terminal_of.hpp>
|
||||
#include <sprout/weed/detail/uncvref.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace weed {
|
||||
namespace traits {
|
||||
//
|
||||
// terminal_or_expr_of
|
||||
//
|
||||
template<typename Arg>
|
||||
struct terminal_or_expr_of {
|
||||
public:
|
||||
typedef typename std::conditional<
|
||||
sprout::weed::traits::is_expr<
|
||||
typename sprout::weed::detail::uncvref<Arg>::type
|
||||
>::value,
|
||||
typename sprout::weed::detail::uncvref<Arg>::type,
|
||||
typename sprout::weed::traits::terminal_of<Arg>::type
|
||||
>::type type;
|
||||
};
|
||||
} // namespace traits
|
||||
} // namespace weed
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_WEED_TRAITS_EXPR_TERMINAL_OR_EXPR_OF_HPP
|
9
sprout/weed/traits/parser.hpp
Normal file
9
sprout/weed/traits/parser.hpp
Normal file
|
@ -0,0 +1,9 @@
|
|||
#ifndef SPROUT_WEED_TRAITS_PARSER_HPP
|
||||
#define SPROUT_WEED_TRAITS_PARSER_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/weed/traits/parser/is_parser.hpp>
|
||||
#include <sprout/weed/traits/parser/attribute_of.hpp>
|
||||
#include <sprout/weed/traits/parser/limit_of.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_WEED_TRAITS_PARSER_HPP
|
115
sprout/weed/traits/parser/attribute_of.hpp
Normal file
115
sprout/weed/traits/parser/attribute_of.hpp
Normal file
|
@ -0,0 +1,115 @@
|
|||
#ifndef SPROUT_WEED_TRAITS_PARSER_ATTRIBUTE_OF_HPP
|
||||
#define SPROUT_WEED_TRAITS_PARSER_ATTRIBUTE_OF_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/weed/unused.hpp>
|
||||
#include <sprout/weed/expr/expr.hpp>
|
||||
#include <sprout/weed/expr/tag.hpp>
|
||||
#include <sprout/weed/traits/type/is_char_type.hpp>
|
||||
#include <sprout/weed/traits/type/is_c_str.hpp>
|
||||
#include <sprout/weed/traits/type/is_string.hpp>
|
||||
#include <sprout/weed/traits/expr/is_expr.hpp>
|
||||
#include <sprout/weed/traits/parser/is_parser.hpp>
|
||||
#include <sprout/weed/traits/parser/limit_of.hpp>
|
||||
#include <sprout/weed/attr_cnv/result_of/times.hpp>
|
||||
#include <sprout/weed/attr_cnv/result_of/shift_left.hpp>
|
||||
#include <sprout/weed/attr_cnv/result_of/modulus.hpp>
|
||||
#include <sprout/weed/attr_cnv/result_of/bitwise_or.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace weed {
|
||||
namespace traits {
|
||||
//
|
||||
// attribute_of
|
||||
//
|
||||
template<typename T, typename Iterator, typename Context, typename = void>
|
||||
struct attribute_of;
|
||||
template<typename T, typename Iterator, typename Context>
|
||||
struct attribute_of<T const, Iterator, Context>
|
||||
: public sprout::weed::traits::attribute_of<T, Iterator, Context>
|
||||
{};
|
||||
template<typename T, typename Iterator, typename Context>
|
||||
struct attribute_of<
|
||||
T,
|
||||
Iterator,
|
||||
Context,
|
||||
typename std::enable_if<
|
||||
sprout::weed::traits::is_parser<T>::value
|
||||
&& !sprout::weed::traits::is_expr<T>::value
|
||||
&& !sprout::weed::traits::is_char_type<T>::value
|
||||
&& !sprout::weed::traits::is_c_str<T>::value
|
||||
&& !sprout::weed::traits::is_string<T>::value
|
||||
>::type
|
||||
> {
|
||||
public:
|
||||
typedef typename T::template attribute<Context, Iterator>::type type;
|
||||
};
|
||||
template<typename T, typename Iterator, typename Context>
|
||||
struct attribute_of<
|
||||
T,
|
||||
Iterator,
|
||||
Context,
|
||||
typename std::enable_if<
|
||||
sprout::weed::traits::is_char_type<T>::value
|
||||
|| sprout::weed::traits::is_c_str<T>::value
|
||||
|| sprout::weed::traits::is_string<T>::value
|
||||
>::type
|
||||
> {
|
||||
public:
|
||||
typedef sprout::weed::unused type;
|
||||
};
|
||||
template<typename Arg, typename Iterator, typename Context>
|
||||
struct attribute_of<sprout::weed::expr<sprout::weed::tag::terminal, Arg>, Iterator, Context>
|
||||
: public sprout::weed::traits::attribute_of<Arg, Iterator, Context>
|
||||
{};
|
||||
template<typename Arg, typename Iterator, typename Context>
|
||||
struct attribute_of<sprout::weed::expr<sprout::weed::tag::unary_plus, Arg>, Iterator, Context>
|
||||
: public sprout::weed::attr_cnv::result_of::times<
|
||||
sprout::weed::traits::limit_of<Arg, Iterator, Context>::value,
|
||||
typename sprout::weed::traits::attribute_of<Arg, Iterator, Context>::type
|
||||
>
|
||||
{};
|
||||
template<typename Arg, typename Iterator, typename Context>
|
||||
struct attribute_of<sprout::weed::expr<sprout::weed::tag::dereference, Arg>, Iterator, Context>
|
||||
: public sprout::weed::attr_cnv::result_of::times<
|
||||
sprout::weed::traits::limit_of<Arg, Iterator, Context>::value,
|
||||
typename sprout::weed::traits::attribute_of<Arg, Iterator, Context>::type
|
||||
>
|
||||
{};
|
||||
template<typename Arg, typename Iterator, typename Context>
|
||||
struct attribute_of<sprout::weed::expr<sprout::weed::tag::address_of, Arg>, Iterator, Context> {
|
||||
public:
|
||||
typedef sprout::weed::unused type;
|
||||
};
|
||||
template<typename Arg, typename Iterator, typename Context>
|
||||
struct attribute_of<sprout::weed::expr<sprout::weed::tag::logical_not, Arg>, Iterator, Context> {
|
||||
public:
|
||||
typedef sprout::weed::unused type;
|
||||
};
|
||||
template<typename Arg1, typename Arg2, typename Iterator, typename Context>
|
||||
struct attribute_of<sprout::weed::expr<sprout::weed::tag::shift_left, Arg1, Arg2>, Iterator, Context>
|
||||
: public sprout::weed::attr_cnv::result_of::shift_left<
|
||||
typename sprout::weed::traits::attribute_of<Arg1, Iterator, Context>::type,
|
||||
typename sprout::weed::traits::attribute_of<Arg2, Iterator, Context>::type
|
||||
>
|
||||
{};
|
||||
template<typename Arg1, typename Arg2, typename Iterator, typename Context>
|
||||
struct attribute_of<sprout::weed::expr<sprout::weed::tag::modulus, Arg1, Arg2>, Iterator, Context>
|
||||
: public sprout::weed::attr_cnv::result_of::modulus<
|
||||
sprout::weed::traits::limit_of<Arg1, Iterator, Context>::value,
|
||||
typename sprout::weed::traits::attribute_of<Arg1, Iterator, Context>::type
|
||||
>
|
||||
{};
|
||||
template<typename Arg1, typename Arg2, typename Iterator, typename Context>
|
||||
struct attribute_of<sprout::weed::expr<sprout::weed::tag::bitwise_or, Arg1, Arg2>, Iterator, Context>
|
||||
: public sprout::weed::attr_cnv::result_of::bitwise_or<
|
||||
typename sprout::weed::traits::attribute_of<Arg1, Iterator, Context>::type,
|
||||
typename sprout::weed::traits::attribute_of<Arg2, Iterator, Context>::type
|
||||
>
|
||||
{};
|
||||
} // namespace traits
|
||||
} // namespace weed
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_WEED_TRAITS_PARSER_ATTRIBUTE_OF_HPP
|
75
sprout/weed/traits/parser/is_parser.hpp
Normal file
75
sprout/weed/traits/parser/is_parser.hpp
Normal file
|
@ -0,0 +1,75 @@
|
|||
#ifndef SPROUT_WEED_TRAITS_PARSER_IS_PARSER_HPP
|
||||
#define SPROUT_WEED_TRAITS_PARSER_IS_PARSER_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/weed/unused.hpp>
|
||||
#include <sprout/weed/parser/parser_base.hpp>
|
||||
#include <sprout/weed/traits/type/is_char_type.hpp>
|
||||
#include <sprout/weed/traits/type/is_c_str.hpp>
|
||||
#include <sprout/weed/traits/expr/is_expr.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace weed {
|
||||
namespace traits {
|
||||
//
|
||||
// is_parser
|
||||
//
|
||||
template<typename T, typename = void>
|
||||
struct is_parser;
|
||||
template<typename T>
|
||||
struct is_parser<
|
||||
T,
|
||||
typename std::enable_if<
|
||||
std::is_const<T>::value
|
||||
&& !std::is_array<T>::value
|
||||
>::type
|
||||
>
|
||||
: public sprout::weed::traits::is_parser<
|
||||
typename std::remove_const<T>::type
|
||||
>
|
||||
{};
|
||||
template<typename T>
|
||||
struct is_parser<
|
||||
T,
|
||||
typename std::enable_if<
|
||||
std::is_base_of<sprout::weed::parser_base, T>::value
|
||||
&& !std::is_const<T>::value
|
||||
>::type
|
||||
>
|
||||
: public std::true_type
|
||||
{};
|
||||
template<typename T>
|
||||
struct is_parser<
|
||||
T,
|
||||
typename std::enable_if<
|
||||
sprout::weed::traits::is_expr<T>::value
|
||||
&& !std::is_const<T>::value
|
||||
>::type
|
||||
>
|
||||
: public std::true_type
|
||||
{};
|
||||
template<typename T>
|
||||
struct is_parser<
|
||||
T,
|
||||
typename std::enable_if<
|
||||
sprout::weed::traits::is_char_type<T>::value
|
||||
&& !std::is_const<T>::value
|
||||
>::type
|
||||
>
|
||||
: public std::true_type
|
||||
{};
|
||||
template<typename T>
|
||||
struct is_parser<
|
||||
T,
|
||||
typename std::enable_if<
|
||||
sprout::weed::traits::is_c_str<T>::value
|
||||
>::type
|
||||
>
|
||||
: public std::true_type
|
||||
{};
|
||||
} // namespace traits
|
||||
} // namespace weed
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_WEED_TRAITS_PARSER_IS_PARSER_HPP
|
32
sprout/weed/traits/parser/limit_of.hpp
Normal file
32
sprout/weed/traits/parser/limit_of.hpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
#ifndef SPROUT_WEED_TRAITS_PARSER_LIMIT_OF_HPP
|
||||
#define SPROUT_WEED_TRAITS_PARSER_LIMIT_OF_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/weed/expr/expr.hpp>
|
||||
#include <sprout/weed/expr/tag.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace weed {
|
||||
namespace traits {
|
||||
//
|
||||
// limit_of
|
||||
//
|
||||
template<typename T, typename Iterator, typename Context, typename = void>
|
||||
struct limit_of
|
||||
: public std::integral_constant<std::size_t, -1>
|
||||
{};
|
||||
template<typename T, typename Iterator, typename Context>
|
||||
struct limit_of<T const, Iterator, Context>
|
||||
: public sprout::weed::traits::limit_of<T, Iterator, Context>
|
||||
{};
|
||||
template<typename Arg, typename Iterator, typename Context>
|
||||
struct limit_of<sprout::weed::expr<sprout::weed::tag::terminal, Arg>, Iterator, Context>
|
||||
: public sprout::weed::traits::limit_of<Arg, Iterator, Context>
|
||||
{};
|
||||
} // namespace traits
|
||||
} // namespace weed
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_WEED_TRAITS_PARSER_LIMIT_OF_HPP
|
12
sprout/weed/traits/type.hpp
Normal file
12
sprout/weed/traits/type.hpp
Normal file
|
@ -0,0 +1,12 @@
|
|||
#ifndef SPROUT_WEED_TRAITS_TYPE_HPP
|
||||
#define SPROUT_WEED_TRAITS_TYPE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/weed/traits/type/is_char_type.hpp>
|
||||
#include <sprout/weed/traits/type/is_c_str.hpp>
|
||||
#include <sprout/weed/traits/type/is_string.hpp>
|
||||
#include <sprout/weed/traits/type/is_container.hpp>
|
||||
#include <sprout/weed/traits/type/is_tuple.hpp>
|
||||
#include <sprout/weed/traits/type/is_unused.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_WEED_TRAITS_TYPE_HPP
|
41
sprout/weed/traits/type/is_c_str.hpp
Normal file
41
sprout/weed/traits/type/is_c_str.hpp
Normal file
|
@ -0,0 +1,41 @@
|
|||
#ifndef SPROUT_WEED_TRAITS_TYPE_IS_C_STR_HPP
|
||||
#define SPROUT_WEED_TRAITS_TYPE_IS_C_STR_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace weed {
|
||||
namespace traits {
|
||||
//
|
||||
// is_c_str
|
||||
//
|
||||
template<typename T>
|
||||
struct is_c_str
|
||||
: public std::false_type
|
||||
{};
|
||||
template<typename T>
|
||||
struct is_c_str<T const>
|
||||
: public sprout::weed::traits::is_c_str<T>
|
||||
{};
|
||||
template<std::size_t N>
|
||||
struct is_c_str<char const[N]>
|
||||
: public std::true_type
|
||||
{};
|
||||
template<std::size_t N>
|
||||
struct is_c_str<wchar_t const[N]>
|
||||
: public std::true_type
|
||||
{};
|
||||
template<std::size_t N>
|
||||
struct is_c_str<char16_t const[N]>
|
||||
: public std::true_type
|
||||
{};
|
||||
template<std::size_t N>
|
||||
struct is_c_str<char32_t const[N]>
|
||||
: public std::true_type
|
||||
{};
|
||||
} // namespace traits
|
||||
} // namespace weed
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_WEED_TRAITS_TYPE_IS_C_STR_HPP
|
41
sprout/weed/traits/type/is_char_type.hpp
Normal file
41
sprout/weed/traits/type/is_char_type.hpp
Normal file
|
@ -0,0 +1,41 @@
|
|||
#ifndef SPROUT_WEED_TRAITS_TYPE_IS_CHAR_TYPE_HPP
|
||||
#define SPROUT_WEED_TRAITS_TYPE_IS_CHAR_TYPE_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace weed {
|
||||
namespace traits {
|
||||
//
|
||||
// is_char_type
|
||||
//
|
||||
template<typename T>
|
||||
struct is_char_type
|
||||
: public std::false_type
|
||||
{};
|
||||
template<typename T>
|
||||
struct is_char_type<T const>
|
||||
: public sprout::weed::traits::is_char_type<T>
|
||||
{};
|
||||
template<>
|
||||
struct is_char_type<char>
|
||||
: public std::true_type
|
||||
{};
|
||||
template<>
|
||||
struct is_char_type<wchar_t>
|
||||
: public std::true_type
|
||||
{};
|
||||
template<>
|
||||
struct is_char_type<char16_t>
|
||||
: public std::true_type
|
||||
{};
|
||||
template<>
|
||||
struct is_char_type<char32_t>
|
||||
: public std::true_type
|
||||
{};
|
||||
} // namespace traits
|
||||
} // namespace weed
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_WEED_TRAITS_TYPE_IS_CHAR_TYPE_HPP
|
35
sprout/weed/traits/type/is_container.hpp
Normal file
35
sprout/weed/traits/type/is_container.hpp
Normal file
|
@ -0,0 +1,35 @@
|
|||
#ifndef SPROUT_WEED_TRAITS_TYPE_IS_CONTAINER_HPP
|
||||
#define SPROUT_WEED_TRAITS_TYPE_IS_CONTAINER_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/string.hpp>
|
||||
#include <sprout/array.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace weed {
|
||||
namespace traits {
|
||||
//
|
||||
// is_container
|
||||
//
|
||||
template<typename T>
|
||||
struct is_container
|
||||
: public std::false_type
|
||||
{};
|
||||
template<typename T>
|
||||
struct is_container<T const>
|
||||
: public sprout::weed::traits::is_container<T>
|
||||
{};
|
||||
template<typename T, std::size_t N>
|
||||
struct is_container<sprout::array<T, N> >
|
||||
: public std::true_type
|
||||
{};
|
||||
template<typename T, std::size_t N, typename Traits>
|
||||
struct is_container<sprout::basic_string<T, N, Traits> >
|
||||
: public std::true_type
|
||||
{};
|
||||
} // namespace traits
|
||||
} // namespace weed
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_WEED_TRAITS_TYPE_IS_CONTAINER_HPP
|
30
sprout/weed/traits/type/is_string.hpp
Normal file
30
sprout/weed/traits/type/is_string.hpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
#ifndef SPROUT_WEED_TRAITS_TYPE_IS_STRING_HPP
|
||||
#define SPROUT_WEED_TRAITS_TYPE_IS_STRING_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/string.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace weed {
|
||||
namespace traits {
|
||||
//
|
||||
// is_string
|
||||
//
|
||||
template<typename T>
|
||||
struct is_string
|
||||
: public std::false_type
|
||||
{};
|
||||
template<typename T>
|
||||
struct is_string<T const>
|
||||
: public sprout::weed::traits::is_string<T>
|
||||
{};
|
||||
template<typename T, std::size_t N, typename Traits>
|
||||
struct is_string<sprout::basic_string<T, N, Traits> >
|
||||
: public std::true_type
|
||||
{};
|
||||
} // namespace traits
|
||||
} // namespace weed
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_WEED_TRAITS_TYPE_IS_STRING_HPP
|
30
sprout/weed/traits/type/is_tuple.hpp
Normal file
30
sprout/weed/traits/type/is_tuple.hpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
#ifndef SPROUT_WEED_TRAITS_TYPE_IS_TUPLE_HPP
|
||||
#define SPROUT_WEED_TRAITS_TYPE_IS_TUPLE_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/tuple/tuple.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace weed {
|
||||
namespace traits {
|
||||
//
|
||||
// is_tuple
|
||||
//
|
||||
template<typename T>
|
||||
struct is_tuple
|
||||
: public std::false_type
|
||||
{};
|
||||
template<typename T>
|
||||
struct is_tuple<T const>
|
||||
: public sprout::weed::traits::is_tuple<T>
|
||||
{};
|
||||
template<typename... Types>
|
||||
struct is_tuple<sprout::tuples::tuple<Types...> >
|
||||
: public std::true_type
|
||||
{};
|
||||
} // namespace traits
|
||||
} // namespace weed
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_WEED_TRAITS_TYPE_IS_TUPLE_HPP
|
26
sprout/weed/traits/type/is_unused.hpp
Normal file
26
sprout/weed/traits/type/is_unused.hpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
#ifndef SPROUT_WEED_TRAITS_TYPE_IS_UNUSED_HPP
|
||||
#define SPROUT_WEED_TRAITS_TYPE_IS_UNUSED_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/weed/unused.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace weed {
|
||||
namespace traits {
|
||||
//
|
||||
// is_unused
|
||||
//
|
||||
template<typename T>
|
||||
struct is_unused
|
||||
: public std::is_same<T, sprout::weed::unused>
|
||||
{};
|
||||
template<typename T>
|
||||
struct is_unused<T const>
|
||||
: public sprout::weed::traits::is_unused<T>
|
||||
{};
|
||||
} // namespace traits
|
||||
} // namespace weed
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_WEED_TRAITS_TYPE_IS_UNUSED_HPP
|
Loading…
Add table
Add a link
Reference in a new issue