1#ifndef ENTT_RESOURCE_RESOURCE_HPP
2#define ENTT_RESOURCE_RESOURCE_HPP
21template<
typename Type>
26 template<
typename Other>
27 static constexpr bool is_acceptable_v = !std::is_same_v<Type, Other> && std::is_constructible_v<Type &, Other &>;
44 : value{std::move(
res)} {}
60 : value{
other.value, std::addressof(
res)} {}
67 template<
typename Other,
typename = std::enable_if_t<is_acceptable_v<Other>>>
69 : value{
other.value} {}
76 template<
typename Other,
typename = std::enable_if_t<is_acceptable_v<Other>>>
78 : value{std::move(
other.value)} {}
113 template<
typename Other,
typename = std::enable_if_t<is_acceptable_v<Other>>>
115 value = std::move(
other.value);
158 return static_cast<bool>(value);
171 value = std::move(
other);
194template<
typename Lhs,
typename Rhs>
196 return (std::addressof(*
lhs) == std::addressof(*
rhs));
207template<
typename Lhs,
typename Rhs>
220template<
typename Lhs,
typename Rhs>
222 return (std::addressof(*
lhs) < std::addressof(*
rhs));
233template<
typename Lhs,
typename Rhs>
247template<
typename Lhs,
typename Rhs>
261template<
typename Lhs,
typename Rhs>
resource(const resource< Other > &other) noexcept
Copy constructs a handle which shares ownership of the resource.
Type element_type
Resource type.
resource(const resource &) noexcept=default
Default copy constructor.
resource & operator=(resource< Other > &&other) noexcept
Move assignment operator from foreign handle.
element_type & operator*() const noexcept
Returns a reference to the managed resource.
const handle_type & handle() const noexcept
Returns the underlying resource handle.
resource & operator=(const resource &) noexcept=default
Default copy assignment operator.
element_type * operator->() const noexcept
Returns a pointer to the managed resource.
void reset(handle_type other)
Replaces the managed resource.
void reset()
Releases the ownership of the managed resource.
resource & operator=(resource &&) noexcept=default
Default move assignment operator.
resource(handle_type res) noexcept
Creates a new resource handle.
void swap(resource &other) noexcept
Exchanges the content with that of a given resource.
resource() noexcept
Default constructor.
~resource()=default
Default destructor.
std::shared_ptr< element_type > handle_type
Handle type.
resource(resource< Other > &&other) noexcept
Move constructs a handle which takes ownership of the resource.
resource(resource &&) noexcept=default
Default move constructor.
constexpr Type make_obj_using_allocator(const Allocator &allocator, Args &&...args)
Uses-allocator construction utility (waiting for C++20).
constexpr bool operator<=(const basic_hashed_string< Char > &lhs, const basic_hashed_string< Char > &rhs) noexcept
Compares two hashed strings.
constexpr bool operator<(const basic_hashed_string< Char > &lhs, const basic_hashed_string< Char > &rhs) noexcept
Compares two hashed strings.
constexpr bool operator!=(const basic_hashed_string< Char > &lhs, const basic_hashed_string< Char > &rhs) noexcept
Compares two hashed strings.
constexpr bool operator>=(const basic_hashed_string< Char > &lhs, const basic_hashed_string< Char > &rhs) noexcept
Compares two hashed strings.
constexpr bool operator>(const basic_hashed_string< Char > &lhs, const basic_hashed_string< Char > &rhs) noexcept
Compares two hashed strings.
constexpr bool operator==(const basic_hashed_string< Char > &lhs, const basic_hashed_string< Char > &rhs) noexcept
Compares two hashed strings.