Sprout/sprout/memory/observer_ptr.hpp

34 lines
1,010 B
C++
Raw Permalink Normal View History

2014-11-28 07:19:07 +00:00
/*=============================================================================
Copyright (c) 2011-2019 Bolero MURAKAMI
2014-11-28 07:19:07 +00:00
https://github.com/bolero-MURAKAMI/Sprout
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef SPROUT_MEMORY_OBSERVER_PTR_HPP
#define SPROUT_MEMORY_OBSERVER_PTR_HPP
#include <sprout/config.hpp>
#include <sprout/memory/exempt_ptr.hpp>
namespace sprout {
//
// make_observer
//
template<typename T>
inline SPROUT_CONSTEXPR sprout::exempt_ptr<T>
make_observer(T* p) SPROUT_NOEXCEPT {
return sprout::exempt_ptr<T>(p);
}
#if SPROUT_USE_TEMPLATE_ALIASES
//
// observer_ptr
//
template<typename T>
using observer_ptr = sprout::exempt_ptr<T>;
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
} // namespace sprout
#endif // #ifndef SPROUT_MEMORY_OBSERVER_PTR_HPP