CYD-UI
A C++ library for building native graphic user interfaces
Loading...
Searching...
No Matches
type_mappings.cppm
Go to the documentation of this file.
1//
2// Created by castle on 2/22/25.
3//
4
6
7import std;
8
9export namespace cydui {
10 template <typename T>
12
13 template <typename T>
14 concept HasInterpolationMapping = requires(T t) {
15 { interp_mapping<T>::to_float(t) } -> std::same_as<float>;
16 { interp_mapping<T>::from_float(std::declval<float>()) } -> std::same_as<T>;
17 };
18
19 template <typename T>
21 static float to_float(const T& val) {
22 return static_cast<float>(val);
23 }
24
25 static T from_float(float val) {
26 return static_cast<T>(val);
27 }
28 };
29}
30
31export template <>
33
34export template <>
36
37export template <>
static float to_float(const T &val)