mirror of
https://github.com/moveit/moveit_task_constructor.git
synced 2025-11-04 14:49:57 +08:00
fixup! containers
accidentally committed sandbox
This commit is contained in:
parent
51e4bba212
commit
f6a40a4a02
@ -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})
|
||||
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
||||
void overloaded( std::unique_ptr<int> const &arg ) {
|
||||
std::cout << " by lvalue " << arg.get() << std::endl;
|
||||
}
|
||||
void overloaded( std::unique_ptr<int> && arg ) {
|
||||
std::unique_ptr<int> 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<int> &&arg ) {
|
||||
std::cout << "- via std::forward: ";
|
||||
overloaded( std::forward<std::unique_ptr<int>&>( 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<int> &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<int>(5));
|
||||
std::cout << "initial caller passes lvalue:\n";
|
||||
auto x = std::make_unique<int>(5);
|
||||
forwarding( x );
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user