Drop some boost deps from json_spirit
authorsvost <ya.nowa@yandex.ru>
Fri, 7 Jan 2022 20:24:00 +0000 (23:24 +0300)
committersvost <ya.nowa@yandex.ru>
Fri, 7 Jan 2022 20:24:00 +0000 (23:24 +0300)
src/json/json_spirit_reader_template.h

index 46f5892..aa6fc61 100644 (file)
 
 //#define BOOST_SPIRIT_THREADSAFE  // uncomment for multithreaded use, requires linking to boost.thread
 
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
 #include <boost/version.hpp>
 
+#include <functional>
+
+
 #if BOOST_VERSION >= 103800
     #include <boost/spirit/include/classic_core.hpp>
     #include <boost/spirit/include/classic_confix.hpp>
@@ -31,6 +32,7 @@
     #define spirit_namespace boost::spirit
 #endif
 
+
 namespace json_spirit
 {
     const spirit_namespace::int_parser < int64_t >  int64_p  = spirit_namespace::int_parser < int64_t  >();
@@ -422,24 +424,26 @@ namespace json_spirit
                 // first we convert the semantic action class methods to functors with the 
                 // parameter signature expected by spirit
 
-                typedef boost::function< void( Char_type )            > Char_action;
-                typedef boost::function< void( Iter_type, Iter_type ) > Str_action;
-                typedef boost::function< void( double )               > Real_action;
-                typedef boost::function< void( int64_t )       > Int_action;
-                typedef boost::function< void( uint64_t )      > Uint64_action;
-
-                Char_action   begin_obj  ( boost::bind( &Semantic_actions_t::begin_obj,   &self.actions_, _1 ) );
-                Char_action   end_obj    ( boost::bind( &Semantic_actions_t::end_obj,     &self.actions_, _1 ) );
-                Char_action   begin_array( boost::bind( &Semantic_actions_t::begin_array, &self.actions_, _1 ) );
-                Char_action   end_array  ( boost::bind( &Semantic_actions_t::end_array,   &self.actions_, _1 ) );
-                Str_action    new_name   ( boost::bind( &Semantic_actions_t::new_name,    &self.actions_, _1, _2 ) );
-                Str_action    new_str    ( boost::bind( &Semantic_actions_t::new_str,     &self.actions_, _1, _2 ) );
-                Str_action    new_true   ( boost::bind( &Semantic_actions_t::new_true,    &self.actions_, _1, _2 ) );
-                Str_action    new_false  ( boost::bind( &Semantic_actions_t::new_false,   &self.actions_, _1, _2 ) );
-                Str_action    new_null   ( boost::bind( &Semantic_actions_t::new_null,    &self.actions_, _1, _2 ) );
-                Real_action   new_real   ( boost::bind( &Semantic_actions_t::new_real,    &self.actions_, _1 ) );
-                Int_action    new_int    ( boost::bind( &Semantic_actions_t::new_int,     &self.actions_, _1 ) );
-                Uint64_action new_uint64 ( boost::bind( &Semantic_actions_t::new_uint64,  &self.actions_, _1 ) );
+                typedef std::function< void( Char_type )            > Char_action;
+                typedef std::function< void( Iter_type, Iter_type ) > Str_action;
+                typedef std::function< void( double )               > Real_action;
+                typedef std::function< void( int64_t )       > Int_action;
+                typedef std::function< void( uint64_t )      > Uint64_action;
+
+                namespace stdp = std::placeholders;
+                Char_action   begin_obj  ( std::bind( &Semantic_actions_t::begin_obj,   &self.actions_, stdp::_1 ) );
+                Char_action   end_obj    ( std::bind( &Semantic_actions_t::end_obj,     &self.actions_, stdp::_1 ) );
+                Char_action   begin_array( std::bind( &Semantic_actions_t::begin_array, &self.actions_, stdp::_1 ) );
+                Char_action   end_array  ( std::bind( &Semantic_actions_t::end_array,   &self.actions_, stdp::_1 ) );
+                Str_action    new_name   ( std::bind( &Semantic_actions_t::new_name,    &self.actions_, stdp::_1, stdp::_2 ) );
+                Str_action    new_str    ( std::bind( &Semantic_actions_t::new_str,     &self.actions_, stdp::_1, stdp::_2 ) );
+                Str_action    new_true   ( std::bind( &Semantic_actions_t::new_true,    &self.actions_, stdp::_1, stdp::_2 ) );
+                Str_action    new_false  ( std::bind( &Semantic_actions_t::new_false,   &self.actions_, stdp::_1, stdp::_2 ) );
+                Str_action    new_null   ( std::bind( &Semantic_actions_t::new_null,    &self.actions_, stdp::_1, stdp::_2 ) );
+                Real_action   new_real   ( std::bind( &Semantic_actions_t::new_real,    &self.actions_, stdp::_1 ) );
+                Int_action    new_int    ( std::bind( &Semantic_actions_t::new_int,     &self.actions_, stdp::_1 ) );
+                Uint64_action new_uint64 ( std::bind( &Semantic_actions_t::new_uint64,  &self.actions_, stdp::_1 ) );
+
 
                 // actual grammer