Code 3

메모리 누수방지를 위해 Lambda 함수에선 weak_ptr로!

ROS2를 공부하면서 이 부분이 잘 몰라서 헤매었다... 스마트 포인터와 람다 함수가 얽혀있는 부분에서 이해가 안되서 쩔쩔 매었다. https://github.com/ros2/demos/blob/rolling/intra_process_demo/src/two_node_pipeline/two_node_pipeline.cpp GitHub - ros2/demos Contribute to ros2/demos development by creating an account on GitHub. github.com 일단 요지는.. 아래 코드에서 weak_ptr이 뜬금없이 들어가있는 거다. std::weak_ptr captured_pub = pub_; 왜 끈금없이 weak_ptr로 할까? 뭔가 람다 함수 내부에서 순환참조..

Code/C++ 2023.05.15

[Python] struct

파이썬이 정말 만능인 것 같다. 아주 단순하게 빠르게 내가 원하는 기능은 다 있다. 특히 struct 라이브러리를 이용하면 쉽게 UART 프로토콜을 맞출 수가 있어서 편리하다. https://docs.python.org/2/library/struct.html 7.3. struct — Interpret strings as packed binary data — Python 2.7.16 documentation 7.3. struct — Interpret strings as packed binary data This module performs conversions between Python values and C structs represented as Python strings. This can be use..

Code/Python 2019.04.28
반응형