2
0
mirror of https://github.com/boostorg/spirit.git synced 2026-01-19 04:42:11 +00:00

Remove deprecated Boost.Bind global placeholders usage

This commit is contained in:
Nikita Kniazev
2020-03-30 20:16:53 +03:00
parent e44a6af723
commit fb52246a00
7 changed files with 15 additions and 7 deletions

View File

@@ -15,7 +15,7 @@
//
///////////////////////////////////////////////////////////////////////////////
#include <boost/spirit/include/classic_core.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <iostream>
#include <vector>
#include <string>
@@ -39,6 +39,7 @@ public:
bool
parse(char const* str)
{
using namespace boost::placeholders;
return BOOST_SPIRIT_CLASSIC_NS::parse(str,
// Begin grammar

View File

@@ -19,7 +19,6 @@
#include <iostream>
#include <boost/spirit/include/classic_core.hpp>
#include <algorithm>
#include <boost/bind.hpp>
#include <boost/spirit/include/classic_push_back_actor.hpp>
#include <boost/spirit/include/classic_lists.hpp>

View File

@@ -9,7 +9,7 @@
#include <boost/config/warning_disable.hpp>
#include <boost/spirit/include/karma.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <iostream>
#include <sstream>
@@ -89,6 +89,7 @@ int main()
}
{ // example using plain function with boost.bind
using namespace boost::placeholders;
std::string generated;
std::back_insert_iterator<std::string> outiter(generated);
@@ -100,6 +101,7 @@ int main()
}
{ // example using member function with boost.bind
using namespace boost::placeholders;
std::string generated;
std::back_insert_iterator<std::string> outiter(generated);

View File

@@ -52,7 +52,7 @@
#include <boost/config/warning_disable.hpp>
//[wcf_includes
#include <boost/spirit/include/lex_lexertl.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <boost/ref.hpp>
//]
@@ -162,6 +162,7 @@ int main(int argc, char* argv[])
// tokenize the given string, the bound functor gets invoked for each of
// the matched tokens
using boost::placeholders::_1;
char const* first = str.c_str();
char const* last = &first[str.size()];
bool r = lex::tokenize(first, last, word_count_functor,

View File

@@ -7,7 +7,7 @@
#include <boost/config/warning_disable.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <iostream>
@@ -76,6 +76,7 @@ int main()
{ // example using boost.bind with a plain function
char const *first = "{44}", *last = first + std::strlen(first);
using boost::placeholders::_1;
//[tutorial_attach_actions3
parse(first, last, '{' >> int_[boost::bind(&print, _1)] >> '}');
//]
@@ -84,6 +85,7 @@ int main()
{ // example using boost.bind with a member function
char const *first = "{44}", *last = first + std::strlen(first);
using boost::placeholders::_1;
//[tutorial_attach_actions4
writer w;
parse(first, last, '{' >> int_[boost::bind(&writer::print, &w, _1)] >> '}');

View File

@@ -14,7 +14,7 @@
#include <boost/spirit/include/karma_action.hpp>
#include <boost/spirit/include/karma_generate.hpp>
#include <boost/spirit/include/karma_operator.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <boost/lambda/lambda.hpp>
#include <sstream>
@@ -73,6 +73,7 @@ int main()
}
{
using namespace boost::placeholders;
BOOST_TEST(test("42", int_[boost::bind(&read1, _1)]));
BOOST_TEST(test_delimited("42 ", int_[boost::bind(&read1, _1)], ' '));
BOOST_TEST(test("42", int_[boost::bind(&read2, _1, _2)]));
@@ -108,6 +109,7 @@ int main()
}
{
using namespace boost::placeholders;
BOOST_TEST(test("{42}", '{' << int_[boost::bind(&read1, _1)] << '}'));
BOOST_TEST(test_delimited("{ 42 } ",
'{' << int_[boost::bind(&read1, _1)] << '}', ' '));

View File

@@ -18,7 +18,7 @@
#include <boost/spirit/include/qi_parse.hpp>
#include <boost/spirit/include/qi_action.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <cstring>
int x = 0;
@@ -89,6 +89,7 @@ int main()
}
{
using boost::placeholders::_1;
char const *s1 = "{42}", *e1 = s1 + std::strlen(s1);
qi::parse(s1, e1, '{' >> int_[boost::bind(&fun1, _1)] >> '}');
}