mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
fix weed type_traits
This commit is contained in:
parent
f712788cce
commit
c78e1d0e6d
27 changed files with 279 additions and 306 deletions
|
@ -5,6 +5,7 @@
|
|||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/iterator/next.hpp>
|
||||
#include <sprout/type_traits/identity.hpp>
|
||||
#include <sprout/weed/unused.hpp>
|
||||
#include <sprout/weed/parser_result.hpp>
|
||||
#include <sprout/weed/parser/parser_base.hpp>
|
||||
|
@ -22,15 +23,13 @@ namespace sprout {
|
|||
{
|
||||
public:
|
||||
template<typename Context, typename Iterator>
|
||||
struct attribute {
|
||||
public:
|
||||
typedef sprout::weed::unused type;
|
||||
};
|
||||
struct attribute
|
||||
: public sprout::identity<sprout::weed::unused>
|
||||
{};
|
||||
template<typename Context, typename Iterator>
|
||||
struct result {
|
||||
public:
|
||||
typedef sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> type;
|
||||
};
|
||||
struct result
|
||||
: public sprout::identity<sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> >
|
||||
{};
|
||||
private:
|
||||
T t_;
|
||||
public:
|
||||
|
@ -81,15 +80,13 @@ namespace sprout {
|
|||
{
|
||||
public:
|
||||
template<typename Context, typename Iterator>
|
||||
struct attribute {
|
||||
public:
|
||||
typedef typename std::iterator_traits<Iterator>::value_type type;
|
||||
};
|
||||
struct attribute
|
||||
: public sprout::identity<typename std::iterator_traits<Iterator>::value_type>
|
||||
{};
|
||||
template<typename Context, typename Iterator>
|
||||
struct result {
|
||||
public:
|
||||
typedef sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> type;
|
||||
};
|
||||
struct result
|
||||
: public sprout::identity<sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> >
|
||||
{};
|
||||
private:
|
||||
T t_;
|
||||
public:
|
||||
|
@ -122,15 +119,13 @@ namespace sprout {
|
|||
{
|
||||
public:
|
||||
template<typename Context, typename Iterator>
|
||||
struct attribute {
|
||||
public:
|
||||
typedef typename std::iterator_traits<Iterator>::value_type type;
|
||||
};
|
||||
struct attribute
|
||||
: public sprout::identity<typename std::iterator_traits<Iterator>::value_type>
|
||||
{};
|
||||
template<typename Context, typename Iterator>
|
||||
struct result {
|
||||
public:
|
||||
typedef sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> type;
|
||||
};
|
||||
struct result
|
||||
: public sprout::identity<sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> >
|
||||
{};
|
||||
public:
|
||||
template<typename Context, typename Iterator>
|
||||
SPROUT_CONSTEXPR typename result<Context, Iterator>::type operator()(
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/iterator/next.hpp>
|
||||
#include <sprout/ctype/ascii.hpp>
|
||||
#include <sprout/type_traits/identity.hpp>
|
||||
#include <sprout/weed/unused.hpp>
|
||||
#include <sprout/weed/parser_result.hpp>
|
||||
#include <sprout/weed/parser/parser_base.hpp>
|
||||
|
@ -18,19 +19,17 @@ namespace sprout {
|
|||
{ \
|
||||
public: \
|
||||
template<typename Context, typename Iterator> \
|
||||
struct attribute { \
|
||||
public: \
|
||||
typedef typename std::conditional< \
|
||||
struct attribute \
|
||||
: public std::conditional< \
|
||||
Nil, \
|
||||
sprout::weed::unused, \
|
||||
typename std::iterator_traits<Iterator>::value_type \
|
||||
>::type type; \
|
||||
}; \
|
||||
> \
|
||||
{}; \
|
||||
template<typename Context, typename Iterator> \
|
||||
struct result { \
|
||||
public: \
|
||||
typedef sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> type; \
|
||||
}; \
|
||||
struct result \
|
||||
: public sprout::identity<sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> > \
|
||||
{}; \
|
||||
public: \
|
||||
template<typename Context, typename Iterator> \
|
||||
SPROUT_CONSTEXPR typename result<Context, Iterator>::type operator()( \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue