CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
is_convertible_to.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include <type_traits>
11
12namespace CeresEngine::traits {
13
16 template<class From, class To, class = void> struct is_convertible_to : std::false_type {};
17
18 template<class From, class To>
20 std::void_t<
21 // clang-format off
22 std::enable_if_t<std::is_convertible_v<From, To>>,
23 decltype(static_cast<To>(std::declval<From>()))
24 // clang-format on
25 >> : std::true_type {};
26
28 template<class From, class To> bool constexpr is_convertible_to_v = is_convertible_to<From, To>::value;
29
31 template<class From, class To>
33
34} // namespace CeresEngine::traits
Definition is_convertible_to.hpp:32
Definition Partitioner.hpp:146
bool constexpr is_convertible_to_v
A C++17 type trait equivalent to the C++20 convertible_to concept.
Definition is_convertible_to.hpp:28
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Definition Span.hpp:668
A C++17 type trait equivalent to the C++20 convertible_to concept.
Definition is_convertible_to.hpp:16