5#if !defined(__XTD_CORE_INTERNAL__)
6#error "Do not include this file: Internal use only"
10#include "../convert_pointer.hpp"
13template<
typename new_type_t,
typename current_type_t,
typename bool_t>
16template<
typename new_type_t,
typename current_type_t>
17struct __as_enum__<new_type_t, current_type_t, std::true_type> {
18 const new_type_t& convert(
const current_type_t& value) {
19 __result__ =
static_cast<new_type_t
>(value);
22 new_type_t& convert(current_type_t& value) {
23 __result__ =
static_cast<new_type_t
>(value);
26 thread_local inline static new_type_t __result__ {};
29template<
typename new_type_t,
typename current_type_t>
30struct __as_enum__<new_type_t, current_type_t, std::false_type> {
31 const new_type_t& convert(
const current_type_t& value) {
32 return xtd::convert_pointer::to_ref<new_type_t>(value);
34 new_type_t& convert(current_type_t& value) {
35 return xtd::convert_pointer::to_ref<new_type_t>(value);