Implement cpputils::destruct(unique_ref)

This commit is contained in:
Sebastian Messmer 2015-07-21 15:23:21 +02:00
parent e9c461e328
commit b5d9f07f7a
2 changed files with 7 additions and 0 deletions

View File

@ -86,6 +86,10 @@ inline boost::optional<unique_ref<T>> nullcheck(std::unique_ptr<T> ptr) {
return boost::none;
}
template<typename T> inline void destruct(unique_ref<T> ptr) {
to_unique_ptr(ptr).reset();
}
//TODO Also allow passing a rvalue reference, otherwise dynamic_pointer_move(func()) won't work
template<typename DST, typename SRC>
inline boost::optional<unique_ref<DST>> dynamic_pointer_move(unique_ref<SRC> &source) {

View File

@ -8,6 +8,9 @@
using namespace cpputils;
//TODO Test unique_ref destructor
//TODO Test cpputils::destruct()
class SomeClass0Parameters {};
class SomeClass1Parameter {
public: