1 #ifndef VCSN_MISC_MEMORY_HH
2 # define VCSN_MISC_MEMORY_HH
12 template <
typename SharedPtr,
typename... Args>
17 using type =
typename SharedPtr::element_type;
18 return std::make_shared<type>(std::forward<Args>(args)...);
25 static std::map<const void*, int> addresses;
26 auto p = addresses.emplace(t, 0);
28 p.first->second = addresses.size();
29 return p.first->second;
47 #endif // !VCSN_MISC_MEMORY_HH
int address(const void *t)
Name pointers, to make them easier to read.
SharedPtr make_shared_ptr(Args &&...args)
Same as std::make_shared, but parameterized by the shared_ptr type, not the (pointed to) element_type...