From f6a40a4a0214c65f84a088b7fa4d120c38e1204e Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Tue, 17 Oct 2017 17:31:44 +0200 Subject: [PATCH] fixup! containers accidentally committed sandbox --- src/demo/CMakeLists.txt | 3 --- src/demo/test.cpp | 33 --------------------------------- src/task.cpp | 1 + 3 files changed, 1 insertion(+), 36 deletions(-) delete mode 100644 src/demo/test.cpp diff --git a/src/demo/CMakeLists.txt b/src/demo/CMakeLists.txt index f3b870c8..94f8658d 100644 --- a/src/demo/CMakeLists.txt +++ b/src/demo/CMakeLists.txt @@ -1,6 +1,3 @@ -add_executable(foo test.cpp) -target_link_libraries(foo) - add_executable(plan_pick_ur5 plan_pick_ur5.cpp) target_link_libraries(plan_pick_ur5 ${PROJECT_NAME}_stages ${PROJECT_NAME}) diff --git a/src/demo/test.cpp b/src/demo/test.cpp deleted file mode 100644 index d53a14b7..00000000 --- a/src/demo/test.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include - -void overloaded( std::unique_ptr const &arg ) { - std::cout << " by lvalue " << arg.get() << std::endl; -} -void overloaded( std::unique_ptr && arg ) { - std::unique_ptr x = std::move(arg); - std::cout << " by rvalue, x: " << x.get() << " arg: " << arg.get() << std::endl; -} - -/* "t &&" with "t" being template param is special, and adjusts "t" to be - (for example) "int &" or non-ref "int" so std::forward knows what to do. */ -void forwarding(std::unique_ptr &&arg ) { - std::cout << "- via std::forward: "; - overloaded( std::forward&>( arg ) ); - std::cout << "- via std::move: "; - overloaded( std::move( arg ) ); // conceptually this would invalidate arg - std::cout << "- by simple passing: "; - overloaded( arg ); -} -void forwarding(std::unique_ptr &arg) { - std::cout << "* via extra std::move" << std::endl; - forwarding(std::move(arg)); -} - -int main() { - std::cout << "initial caller passes rvalue:\n"; - forwarding(std::make_unique(5)); - std::cout << "initial caller passes lvalue:\n"; - auto x = std::make_unique(5); - forwarding( x ); -} diff --git a/src/task.cpp b/src/task.cpp index 57348c92..7b515d06 100644 --- a/src/task.cpp +++ b/src/task.cpp @@ -120,6 +120,7 @@ const robot_state::RobotState& Task::getCurrentRobotState() const { void Task::printState(){ ContainerBase::StageCallback processor = [](const Stage& stage, int depth) -> bool { std::cout << std::string(2*depth, ' ') << stage << std::endl; + return true; }; traverseStages(processor); }