Skip to content

Commit

Permalink
Merge pull request #120 from lucasw/boost_placeholders
Browse files Browse the repository at this point in the history
Use C++17 if available, and boost::placeholders::_1/_2/_3 instead of deprecated _1/_2/_3
  • Loading branch information
matlabbe authored May 9, 2022
2 parents f7c38f9 + 270e858 commit 3dae099
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,12 @@ IF(NOT MSVC)
IF( NOT CMAKE_CXX_STANDARD AND OpenCV_VERSION_MAJOR EQUAL 4)
#Newest versions require std11
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
IF(COMPILER_SUPPORTS_CXX11)
IF(COMPILER_SUPPORTS_CXX17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
ELSEIF(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
ELSEIF(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
Expand Down
6 changes: 4 additions & 2 deletions src/ros/CameraROS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,14 @@ CameraROS::CameraROS(bool subscribeDepth, QObject * parent) :
if(approxSync)
{
approxSync_ = new message_filters::Synchronizer<MyApproxSyncPolicy>(MyApproxSyncPolicy(queueSize), rgbSub_, depthSub_, cameraInfoSub_);
approxSync_->registerCallback(boost::bind(&CameraROS::imgDepthReceivedCallback, this, _1, _2, _3));
approxSync_->registerCallback(boost::bind(&CameraROS::imgDepthReceivedCallback, this,
boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3));
}
else
{
exactSync_ = new message_filters::Synchronizer<MyExactSyncPolicy>(MyExactSyncPolicy(queueSize), rgbSub_, depthSub_, cameraInfoSub_);
exactSync_->registerCallback(boost::bind(&CameraROS::imgDepthReceivedCallback, this, _1, _2, _3));
exactSync_->registerCallback(boost::bind(&CameraROS::imgDepthReceivedCallback, this,
boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3));
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/ros/print_objects_detected_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ int main(int argc, char** argv)
message_filters::Subscriber<find_object_2d::ObjectsStamped> objectsSub;
objectsSub.subscribe(nh, "objectsStamped", 1);
message_filters::Synchronizer<MyExactSyncPolicy> exactSync(MyExactSyncPolicy(10), imageSub, objectsSub);
exactSync.registerCallback(boost::bind(&imageObjectsDetectedCallback, _1, _2));
exactSync.registerCallback(boost::bind(&imageObjectsDetectedCallback,
boost::placeholders::_1, boost::placeholders::_2));

imagePub = it.advertise("image_with_objects", 1);

Expand Down

0 comments on commit 3dae099

Please sign in to comment.