/****************************************************************************** * Copyright (c) 2016, Connor Manning (connor@hobu.co) * * Entwine -- Point cloud indexing * * Entwine is available under the terms of the LGPL2 license. See COPYING * for specific license text and more information. * ******************************************************************************/ #pragma once #include namespace entwine { template std::unique_ptr makeUnique(Args&&... args) { return std::unique_ptr(new T(std::forward(args)...)); } template std::unique_ptr clone(const T& t) { return makeUnique(t); } template std::unique_ptr maybeClone(const T* t) { if (t) return makeUnique(*t); else return std::unique_ptr(); } template inline std::shared_ptr maybeDefault(std::shared_ptr v) { return v ? v : std::make_shared(); } } // namespace entwine