Skip to content

Commit

Permalink
Adding rationale behind deferred_ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
kunaltyagi committed Feb 28, 2020
1 parent 695e7d0 commit 7910524
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions io/include/pcl/io/grabber.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,11 @@ namespace pcl
{
using Signal = boost::signals2::signal<T>;
using Base = boost::signals2::signal_base;
// DefferedPtr serves 2 purposes:
// * allows MSVC to copy it around, can't do that with unique_ptr<T>
// * performs dynamic allocation only when required. If the key is found, this
// struct is a no-op, otherwise it allocates when implicit conversion operator
// is called inside emplace/try_emplace
struct DefferedPtr {
operator std::unique_ptr<Base>() const { return std::make_unique<Signal>(); }
};
Expand Down

0 comments on commit 7910524

Please sign in to comment.