37 friend struct std::hash<base_type>;
44 virtual void _accept(mstd::function_view<
void(
const scalar_type&)> scalarVisit,
45 mstd::function_view<
void(
const vec_type&)> vecVisit, mstd::function_view<
void(
const mat_type&)> matVisit,
46 mstd::function_view<
void(
const struct_type&)> structVisit,
47 mstd::function_view<
void(
const array_type&)> arrayVisit)
const = 0;
51 explicit base_type(size_t size)
noexcept;
53 base_type(
const base_type& other)
noexcept;
55 base_type(base_type&& other)
noexcept;
57 virtual ~base_type()
noexcept;
60 base_type& operator=(
const base_type& other)
noexcept;
62 base_type& operator=(base_type&& other)
noexcept;
66 template<type_visitor T>
68 template<
class T, std::enable_if_t<is_type_visitor_v<T>,
bool> =
true>
70 void accept(T& visitor)
const {
71 _accept([&visitor](
const scalar_type& s) { visitor.visit(s); }, [&visitor](
const vec_type& v) { visitor.visit(v); },
72 [&visitor](
const mat_type& m) { visitor.visit(m); }, [&visitor](
const struct_type& s) { visitor.visit(s); },
73 [&visitor](
const array_type& a) { visitor.visit(a); });
77 [[nodiscard]]
virtual bool operator==(
const base_type& other)
const noexcept;
79 [[nodiscard]]
bool operator!=(
const base_type& other)
const noexcept;
81 template<utils::glsl_type T>
83 template<
class T, std::enable_if_t<utils::is_glsl_type_v<T>,
bool> >
87 template<utils::glsl_type T>
89 template<
class T, std::enable_if_t<utils::is_glsl_type_v<T>,
bool> >
94 [[nodiscard]] size_t get_size()
const noexcept;
97 [[nodiscard]]
virtual std::string to_string()
const noexcept = 0;
101
102
103
104 [[nodiscard]] size_t sizeof_type(
const base_type_handle& type)
noexcept;
107
108
109
111 template<utils::glsl_type T>
113 template<
class T, std::enable_if_t<utils::is_glsl_type_v<T>,
bool> =
true>
115 [[nodiscard]] size_t sizeof_type(
const std::shared_ptr<T>& type)
noexcept {
116 return type->get_size();
120
121
122
123 [[nodiscard]] std::string to_string(
const base_type_handle& type)
noexcept;
126
127
128
130 template<utils::glsl_type T>
132 template<
class T, std::enable_if_t<utils::is_glsl_type_v<T>,
bool> =
true>
134 [[nodiscard]] std::string to_string(
const std::shared_ptr<T>& type)
noexcept {
135 return type->to_string();
139
140
141
143 template<utils::glsl_type T>
145 template<
class T, std::enable_if_t<utils::is_glsl_type_v<T>,
bool> =
true>
152
153
154
156 template<utils::glsl_type T>
158 template<
class T, std::enable_if_t<utils::is_glsl_type_v<T>,
bool> =
true>
166
167
168
170struct std::hash<glslstruct::base_type> {
171 [[nodiscard]] size_t operator()(
const glslstruct::base_type& type)
const noexcept;
#define _GLSL_STRUCT_HAS_CXX20
check if compiler has c++ version greater or equal to c++20 and if user enabled c++20 features using ...
Definition config.hpp:142
#define _GLSL_STRUCT_HAS_TYPES
check if user not disabled type containers using GLSL_STRUCT_DISABLE_TYPES
Definition config.hpp:162