mirror of
https://github.com/boostorg/spirit.git
synced 2026-01-19 04:42:11 +00:00
Include needed parts at place where they are needed instead of including the whole Proto library and significant parts of Phoenix in a few places. Parsing time reported by Clang 9 with default (C++14) std: was |now |gain|include ----|----|----|---------- 4.45|4.22|5.2%|qi 4.52|4.23|7.5%|karma 4.37|3.99|9.7%|lex 3.75|3.47|7.5%|qi_numeric There were phoenix/limits.hpp inclusion before every Proto inclusion to override Proto limits with Phoenix limits values. It has no value in C++11+ world, and poisons code too much as the number of places where Proto headers now included increased, so I did not replicate it.
32 lines
1.2 KiB
C++
32 lines
1.2 KiB
C++
/*=============================================================================
|
|
Copyright (c) 2001-2011 Hartmut Kaiser
|
|
Copyright (c) 2011 Robert Nelson
|
|
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
=============================================================================*/
|
|
|
|
// These (compilation) tests verify that Proto's operator overloads do not
|
|
// trigger the corresponding operator overloads exposed by Fusion.
|
|
|
|
#include <boost/fusion/tuple.hpp>
|
|
#include <boost/spirit/include/qi_operator.hpp>
|
|
#include <boost/spirit/include/qi_eps.hpp>
|
|
#include <boost/spirit/include/qi_nonterminal.hpp>
|
|
#include <boost/phoenix/core/reference.hpp>
|
|
#include <string>
|
|
|
|
int main()
|
|
{
|
|
namespace qi = boost::spirit::qi;
|
|
|
|
static qi::rule<std::string::const_iterator> const a;
|
|
static qi::rule<std::string::const_iterator> const b;
|
|
qi::rule<std::string::const_iterator> rule = a > b;
|
|
|
|
int vars;
|
|
qi::rule<std::string::const_iterator, int(const int&)> const r;
|
|
qi::rule<std::string::const_iterator, int()> r2 =
|
|
r(boost::phoenix::ref(vars)) > qi::eps;
|
|
}
|