mirror of https://github.com/oxen-io/lokinet
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
293 B
C++
14 lines
293 B
C++
6 years ago
|
#ifndef LLARP_UTIL_COPY_OR_NULLPTR_HPP
|
||
|
#define LLARP_UTIL_COPY_OR_NULLPTR_HPP
|
||
|
#include <memory>
|
||
|
|
||
|
template < typename T >
|
||
|
static constexpr std::unique_ptr< T >
|
||
|
copy_or_nullptr(const std::unique_ptr< T >& other)
|
||
|
{
|
||
|
if(other)
|
||
|
return std::make_unique< T >(*other);
|
||
|
return nullptr;
|
||
|
}
|
||
|
|
||
|
#endif
|