Skip to content

Commit 6276560

Browse files
committed
fix boost >= 1.73 bind warnings
1 parent 74557fd commit 6276560

File tree

12 files changed

+115
-56
lines changed

12 files changed

+115
-56
lines changed

include/dynamic-graph/command-bind.h

Lines changed: 50 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
#include "dynamic-graph/command.h"
2424
#include <boost/assign/list_of.hpp>
25-
#include <boost/bind.hpp>
25+
#include <boost/bind/bind.hpp>
2626
#include <boost/function.hpp>
2727

2828
/* --- FUNCTION 0 ARGS ----------------------------------------------------- */
@@ -111,15 +111,17 @@ makeCommandVoid1(E &entity,
111111
// the template arg... why ???
112112
boost::function<void(E *, const T &)> function,
113113
const std::string &docString) {
114-
return new CommandVoid1<E, T>(entity, boost::bind(function, &entity, _1),
115-
docString);
114+
return new CommandVoid1<E, T>(
115+
entity, boost::bind(function, &entity, boost::placeholders::_1),
116+
docString);
116117
}
117118

118119
template <class E, typename T>
119120
CommandVoid1<E, T> *makeCommandVoid1(E &entity, void (E::*function)(const T &),
120121
const std::string &docString) {
121-
return new CommandVoid1<E, T>(entity, boost::bind(function, &entity, _1),
122-
docString);
122+
return new CommandVoid1<E, T>(
123+
entity, boost::bind(function, &entity, boost::placeholders::_1),
124+
docString);
123125
return NULL;
124126
}
125127

@@ -175,16 +177,22 @@ makeCommandVoid2(E &entity,
175177
// the template arg... why ???
176178
boost::function<void(E *, const T1 &, const T2 &)> function,
177179
const std::string &docString) {
178-
return new CommandVoid2<E, T1, T2>(
179-
entity, boost::bind(function, &entity, _1, _2), docString);
180+
return new CommandVoid2<E, T1, T2>(entity,
181+
boost::bind(function, &entity,
182+
boost::placeholders::_1,
183+
boost::placeholders::_2),
184+
docString);
180185
}
181186

182187
template <class E, typename T1, typename T2>
183188
CommandVoid2<E, T1, T2> *
184189
makeCommandVoid2(E &entity, void (E::*function)(const T1 &, const T2 &),
185190
const std::string &docString) {
186-
return new CommandVoid2<E, T1, T2>(
187-
entity, boost::bind(function, &entity, _1, _2), docString);
191+
return new CommandVoid2<E, T1, T2>(entity,
192+
boost::bind(function, &entity,
193+
boost::placeholders::_1,
194+
boost::placeholders::_2),
195+
docString);
188196
return NULL;
189197
}
190198

@@ -243,7 +251,10 @@ CommandVoid3<E, T1, T2, T3> *makeCommandVoid3(
243251
boost::function<void(E *, const T1 &, const T2 &, const T3 &)> function,
244252
const std::string &docString) {
245253
return new CommandVoid3<E, T1, T2, T3>(
246-
entity, boost::bind(function, &entity, _1, _2, _3), docString);
254+
entity,
255+
boost::bind(function, &entity, boost::placeholders::_1,
256+
boost::placeholders::_2, boost::placeholders::_3),
257+
docString);
247258
}
248259

249260
template <class E, typename T1, typename T2, typename T3>
@@ -252,7 +263,10 @@ makeCommandVoid3(E &entity,
252263
void (E::*function)(const T1 &, const T2 &, const T3 &),
253264
const std::string &docString) {
254265
return new CommandVoid3<E, T1, T2, T3>(
255-
entity, boost::bind(function, &entity, _1, _2, _3), docString);
266+
entity,
267+
boost::bind(function, &entity, boost::placeholders::_1,
268+
boost::placeholders::_2, boost::placeholders::_3),
269+
docString);
256270
return NULL;
257271
}
258272

@@ -317,7 +331,11 @@ CommandVoid4<E, T1, T2, T3, T4> *makeCommandVoid4(
317331
function,
318332
const std::string &docString) {
319333
return new CommandVoid4<E, T1, T2, T3, T4>(
320-
entity, boost::bind(function, &entity, _1, _2, _3, _4), docString);
334+
entity,
335+
boost::bind(function, &entity, boost::placeholders::_1,
336+
boost::placeholders::_2, boost::placeholders::_3,
337+
boost::placeholders::_4),
338+
docString);
321339
}
322340

323341
template <class E, typename T1, typename T2, typename T3, typename T4>
@@ -326,7 +344,11 @@ CommandVoid4<E, T1, T2, T3, T4> *makeCommandVoid4(
326344
void (E::*function)(const T1 &, const T2 &, const T3 &, const T4 &),
327345
const std::string &docString) {
328346
return new CommandVoid4<E, T1, T2, T3, T4>(
329-
entity, boost::bind(function, &entity, _1, _2, _3, _4), docString);
347+
entity,
348+
boost::bind(function, &entity, boost::placeholders::_1,
349+
boost::placeholders::_2, boost::placeholders::_3,
350+
boost::placeholders::_4),
351+
docString);
330352
return NULL;
331353
}
332354

@@ -379,8 +401,9 @@ template <class E>
379401
CommandVerbose<E> *makeCommandVerbose(E &entity,
380402
void (E::*function)(std::ostream &),
381403
const std::string &docString) {
382-
return new CommandVerbose<E>(entity, boost::bind(function, &entity, _1),
383-
docString);
404+
return new CommandVerbose<E>(
405+
entity, boost::bind(function, &entity, boost::placeholders::_1),
406+
docString);
384407
return NULL;
385408
}
386409

@@ -484,15 +507,17 @@ makeCommandReturnType1(E &entity,
484507
boost::function<ReturnType(E *, const T &)> function,
485508
const std::string &docString) {
486509
return new CommandReturnType1<E, ReturnType, T>(
487-
entity, boost::bind(function, &entity, _1), docString);
510+
entity, boost::bind(function, &entity, boost::placeholders::_1),
511+
docString);
488512
}
489513

490514
template <class E, typename ReturnType, typename T>
491515
CommandReturnType1<E, ReturnType, T> *
492516
makeCommandReturnType1(E &entity, ReturnType (E::*function)(const T &),
493517
const std::string &docString) {
494518
return new CommandReturnType1<E, ReturnType, T>(
495-
entity, boost::bind(function, &entity, _1), docString);
519+
entity, boost::bind(function, &entity, boost::placeholders::_1),
520+
docString);
496521
return NULL;
497522
}
498523

@@ -551,7 +576,10 @@ CommandReturnType2<E, ReturnType, T1, T2> *makeCommandReturnType2(
551576
boost::function<ReturnType(E *, const T1 &, const T2 &)> function,
552577
const std::string &docString) {
553578
return new CommandReturnType2<E, ReturnType, T1, T2>(
554-
entity, boost::bind(function, &entity, _1, _2), docString);
579+
entity,
580+
boost::bind(function, &entity, boost::placeholders::_1,
581+
boost::placeholders::_2),
582+
docString);
555583
}
556584

557585
template <class E, typename ReturnType, typename T1, typename T2>
@@ -560,7 +588,10 @@ makeCommandReturnType2(E &entity,
560588
ReturnType (E::*function)(const T1 &, const T2 &),
561589
const std::string &docString) {
562590
return new CommandReturnType2<E, ReturnType, T1, T2>(
563-
entity, boost::bind(function, &entity, _1, _2), docString);
591+
entity,
592+
boost::bind(function, &entity, boost::placeholders::_1,
593+
boost::placeholders::_2),
594+
docString);
564595
return NULL;
565596
}
566597

include/dynamic-graph/signal-helper.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,18 @@
2626
#type + ")::" + #name)
2727
#define BIND_SIGNAL_TO_FUNCTION(name, IO, type) \
2828
m_##name##S##IO.setFunction(boost::bind( \
29-
&EntityClassName::SIGNAL_OUT_FUNCTION_NAME(name), this, _1, _2));
29+
&EntityClassName::SIGNAL_OUT_FUNCTION_NAME(name), this,
30+
boost::placeholders::_1, boost::placeholders::_2));
3031

31-
/**/
32+
/**/
3233

3334
#define DECLARE_SIGNAL_IN(name, type) \
3435
::dynamicgraph::SignalPtr<type, int> m_##name##SIN
3536
#define CONSTRUCT_SIGNAL_IN(name, type) \
3637
m_##name##SIN(NULL, getClassName() + "(" + getName() + ")::input(" + #type + \
3738
")::" + #name)
3839

39-
/**/
40+
/**/
4041

4142
#define DECLARE_SIGNAL_OUT_FUNCTION(name, type) \
4243
type &SIGNAL_OUT_FUNCTION_NAME(name)(type &, int)
@@ -55,10 +56,12 @@ protected: \
5556

5657
#define CONSTRUCT_SIGNAL_OUT(name, type, dep) \
5758
m_##name##SOUT( \
58-
boost::bind(&EntityClassName::name##SOUT_function, this, _1, _2), dep, \
59+
boost::bind(&EntityClassName::name##SOUT_function, this, \
60+
boost::placeholders::_1, boost::placeholders::_2), \
61+
dep, \
5962
getClassName() + "(" + getName() + ")::output(" + #type + ")::" + #name)
6063

61-
/**************** INNER SIGNALS *******************/
64+
/**************** INNER SIGNALS *******************/
6265
#define SIGNAL_INNER_FUNCTION_NAME(name) name##SINNER_function
6366

6467
#define DECLARE_SIGNAL_INNER_FUNCTION(name, type) \
@@ -76,7 +79,9 @@ protected: \
7679

7780
#define CONSTRUCT_SIGNAL_INNER(name, type, dep) \
7881
m_##name##SINNER( \
79-
boost::bind(&EntityClassName::name##SINNER_function, this, _1, _2), dep, \
82+
boost::bind(&EntityClassName::name##SINNER_function, this, \
83+
boost::placeholders::_1, boost::placeholders::_2), \
84+
dep, \
8085
getClassName() + "(" + getName() + ")::inner(" + #type + ")::" + #name)
8186

8287
#endif // __dynamic_graph_signal_helper_H__

include/dynamic-graph/signal-time-dependent.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ namespace dynamicgraph {
3838
: Entity (name)
3939
, signal (
4040
// Set the function that computes the signal value
41-
boost::bind (&Entity::computeSignal, this, _1, _2),
41+
boost::bind (&Entity::computeSignal, this, boost::placeholders::_1,
42+
boost::placeholders::_2),
4243
// Declare the dependencies
4344
dep1 << dep2,
4445
"signalname")

include/dynamic-graph/signal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#ifndef __SIGNAL_HH
1111
#define __SIGNAL_HH
1212

13-
#include <boost/bind.hpp>
13+
#include <boost/bind/bind.hpp>
1414
#include <boost/function.hpp>
1515

1616
#include <string>

src/traces/tracer-real-time.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
/* --------------------------------------------------------------------- */
1313

1414
/* DG */
15-
#include <boost/bind.hpp>
15+
#include <boost/bind/bind.hpp>
1616
#include <iomanip>
1717

1818
#include <dynamic-graph/all-commands.h>

src/traces/tracer.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
/* --------------------------------------------------------------------- */
1313

1414
/* DG */
15-
#include <boost/bind.hpp>
15+
#include <boost/bind/bind.hpp>
1616
#include <dynamic-graph/all-commands.h>
1717
#include <dynamic-graph/debug.h>
1818
#include <dynamic-graph/factory.h>
@@ -34,8 +34,9 @@ Tracer::Tracer(const std::string n)
3434
: Entity(n), toTraceSignals(), traceStyle(TRACE_STYLE_DEFAULT),
3535
frequency(1), basename(), suffix(".dat"), rootdir(), namesSet(false),
3636
files(), names(), play(false), timeStart(0),
37-
triger(boost::bind(&Tracer::recordTrigger, this, _1, _2), sotNOSIGNAL,
38-
"Tracer(" + n + ")::triger") {
37+
triger(boost::bind(&Tracer::recordTrigger, this, boost::placeholders::_1,
38+
boost::placeholders::_2),
39+
sotNOSIGNAL, "Tracer(" + n + ")::triger") {
3940
signalRegistration(triger);
4041

4142
/* --- Commands --- */

tests/debug-real-time-tracer.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@ struct MyEntity : public dynamicgraph::Entity {
3535
explicit MyEntity(const std::string &name)
3636
: Entity(name),
3737
m_sigdSIN("MyEntity(" + name + ")::input(double)::in_double"),
38-
m_sigdTimeDepSOUT(boost::bind(&MyEntity::update, this, _1, _2),
39-
m_sigdSIN,
40-
"MyEntity(" + name + ")::input(double)::out_double"),
38+
m_sigdTimeDepSOUT(
39+
boost::bind(&MyEntity::update, this, boost::placeholders::_1,
40+
boost::placeholders::_2),
41+
m_sigdSIN, "MyEntity(" + name + ")::input(double)::out_double"),
4142
m_sigdTwoTimeDepSOUT(
42-
boost::bind(&MyEntity::update, this, _1, _2), m_sigdSIN,
43-
"MyEntity(" + name + ")::input(double)::out2double")
43+
boost::bind(&MyEntity::update, this, boost::placeholders::_1,
44+
boost::placeholders::_2),
45+
m_sigdSIN, "MyEntity(" + name + ")::input(double)::out2double")
4446

4547
{
4648
signalRegistration(m_sigdSIN << m_sigdTimeDepSOUT << m_sigdTwoTimeDepSOUT);

tests/debug-tracer.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,18 @@ struct MyEntity : public dynamicgraph::Entity {
3535
explicit MyEntity(const std::string &name)
3636
: Entity(name),
3737
m_sigdSIN("MyEntity(" + name + ")::input(double)::in_double"),
38-
m_sigdTimeDepSOUT(boost::bind(&MyEntity::update, this, _1, _2),
39-
m_sigdSIN,
40-
"MyEntity(" + name + ")::input(double)::out_double"),
41-
m_sigVTimeDepSOUT(boost::bind(&MyEntity::updateVector, this, _1, _2),
42-
m_sigdSIN,
43-
"MyEntity(" + name + ")::input(vector)::out_vector"),
38+
m_sigdTimeDepSOUT(
39+
boost::bind(&MyEntity::update, this, boost::placeholders::_1,
40+
boost::placeholders::_2),
41+
m_sigdSIN, "MyEntity(" + name + ")::input(double)::out_double"),
42+
m_sigVTimeDepSOUT(
43+
boost::bind(&MyEntity::updateVector, this, boost::placeholders::_1,
44+
boost::placeholders::_2),
45+
m_sigdSIN, "MyEntity(" + name + ")::input(vector)::out_vector"),
4446
m_sigdTwoTimeDepSOUT(
45-
boost::bind(&MyEntity::update, this, _1, _2), m_sigdSIN,
46-
"MyEntity(" + name + ")::input(double)::out2double")
47+
boost::bind(&MyEntity::update, this, boost::placeholders::_1,
48+
boost::placeholders::_2),
49+
m_sigdSIN, "MyEntity(" + name + ")::input(double)::out2double")
4750

4851
{
4952
signalRegistration(m_sigdSIN << m_sigdTimeDepSOUT << m_sigVTimeDepSOUT

tests/entity.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ class CustomEntity : public Entity {
4141
m_sigdSIN2(NULL,
4242
"CustomEntity(" + name + ")::input(double)::in_double"),
4343
m_sigdTimeDepSOUT(
44-
boost::bind(&CustomEntity::update, this, _1, _2), m_sigdSIN,
45-
"CustomEntity(" + name + ")::input(double)::out_double"),
44+
boost::bind(&CustomEntity::update, this, boost::placeholders::_1,
45+
boost::placeholders::_2),
46+
m_sigdSIN, "CustomEntity(" + name + ")::input(double)::out_double"),
4647
m_value(0.0) {}
4748

4849
~CustomEntity() { entityDeregistration(); }

tests/pool.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ struct MyEntity : public dynamicgraph::Entity {
3030
explicit MyEntity(const std::string &name)
3131
: Entity(name),
3232
m_sigdSIN(NULL, "MyEntity(" + name + ")::input(double)::in_double"),
33-
m_sigdTimeDepSOUT(boost::bind(&MyEntity::update, this, _1, _2),
34-
m_sigdSIN,
35-
"MyEntity(" + name + ")::input(double)::out_double") {
33+
m_sigdTimeDepSOUT(
34+
boost::bind(&MyEntity::update, this, boost::placeholders::_1,
35+
boost::placeholders::_2),
36+
m_sigdSIN, "MyEntity(" + name + ")::input(double)::out_double") {
3637
signalRegistration(m_sigdSIN << m_sigdTimeDepSOUT);
3738
}
3839

0 commit comments

Comments
 (0)