MCPcopy Create free account
hub / github.com/Naios/function2 / address_taker

Class address_taker

include/function2/function2.hpp:339–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

337/// Specialization to work with addresses of callable objects
338template <typename T, typename = void>
339struct address_taker {
340 template <typename O>
341 static auto take(O&& obj) {
342 return std::addressof(obj);
343 }
344 static T& restore(void* ptr) {
345 return *static_cast<T*>(ptr);
346 }
347 static T const& restore(void const* ptr) {
348 return *static_cast<T const*>(ptr);
349 }
350 static T volatile& restore(void volatile* ptr) {
351 return *static_cast<T volatile*>(ptr);
352 }
353 static T const volatile& restore(void const volatile* ptr) {
354 return *static_cast<T const volatile*>(ptr);
355 }
356};
357/// Specialization to work with addresses of raw function pointers
358template <typename T>
359struct address_taker<T, std::enable_if_t<std::is_pointer<T>::value>> {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected