di 0.1.0
Loading...
Searching...
No Matches
relocate.h
Go to the documentation of this file.
1#pragma once
2
4#include "di/util/addressof.h"
6#include "di/util/move.h"
7
8namespace di::util {
9namespace detail {
10 struct RelocateFunction {
11 template<concepts::Destructible T>
12 requires(concepts::MoveConstructible<T>)
13 constexpr auto operator()(T& reference) const -> T {
14 auto result = util::move(reference);
15 destroy_at(util::addressof(reference));
16 return result;
17 }
18 };
19}
20
21constexpr inline auto relocate = detail::RelocateFunction {};
22}
23
24namespace di {
25using util::relocate;
26}
Definition vocab.h:96
constexpr auto relocate
Definition relocate.h:21
constexpr auto destroy_at
Definition destroy_at.h:24
Definition any_storable.h:9