eedb/share/include/tao/json/external/pegtl/internal/rule_conjunction.hh
2017-02-26 09:32:45 +01:00

35 lines
1.0 KiB
C++

// Copyright (c) 2014-2015 Dr. Colin Hirsch and Daniel Frey
// Please see LICENSE for license or visit https://github.com/ColinH/PEGTL/
#ifndef TAO_CPP_PEGTL_INTERNAL_RULE_CONJUNCTION_HH
#define TAO_CPP_PEGTL_INTERNAL_RULE_CONJUNCTION_HH
#include "../apply_mode.hh"
namespace tao_json_pegtl
{
namespace internal
{
template< typename ... Rules >
struct rule_conjunction
{
template< apply_mode A, template< typename ... > class Action, template< typename ... > class Control, typename Input, typename ... States >
static bool match( Input & in, States && ... st )
{
#ifdef __cpp_fold_expressions
return ( Control< Rules >::template match< A, Action, Control >( in, st ... ) && ... );
#else
bool result = true;
using swallow = bool[];
(void)swallow{ result = result && Control< Rules >::template match< A, Action, Control >( in, st ... ) ..., true };
return result;
#endif
}
};
} // namespace internal
} // namespace tao_json_pegtl
#endif