44 virtual void _accept(mstd::function_view<
void(
const scalar_type&)> scalarVisit,
70 void accept(V&& visitor)
const {
71 _accept([&visitor](
const scalar_type& s) { visitor(s); }, [&visitor](
const vec_type& v) { visitor(v); },
72 [&visitor](
const mat_type& m) { visitor(m); }, [&visitor](
const struct_type& s) { visitor(s); },
73 [&visitor](
const array_type& a) { visitor(a); });
94 [[nodiscard]] size_t get_size()
const noexcept;
97 [[nodiscard]]
virtual std::string to_string()
const noexcept = 0;
101
102
103
104 [[nodiscard]]
_GLSL_STRUCT_EXPORT size_t sizeof_type(
const base_type_handle& type)
noexcept;
107
108
109
111 template<glsl_type T>
113 template<
class T, std::enable_if_t<is_glsl_type_v<T>,
bool> =
true>
116 return type->get_size();
120
121
122
123 [[nodiscard]]
_GLSL_STRUCT_EXPORT std::string to_string(
const base_type_handle& type)
noexcept;
126
127
128
130 template<glsl_type T>
132 template<
class T, std::enable_if_t<is_glsl_type_v<T>,
bool> =
true>
134 [[nodiscard]]
inline std::string to_string(
const std::shared_ptr<T>& type)
noexcept {
135 return type->to_string();
140
141
142
144 template<type_visitor V>
146 template<
class V, std::enable_if_t<is_type_visitor_v<V>,
bool> =
true>
148 inline void visit(V&& visitor,
const base_type_handle& type) {
149 type->accept(visitor);
153
154
155
157 template<glsl_type T, type_visitor V>
159 template<
class T,
class V, std::enable_if_t<is_glsl_type_v<T> && is_type_visitor_v<V>,
bool> =
true>
161 inline void visit(V&& visitor,
const std::shared_ptr<T>& type) {
162 type->accept(visitor);
166
167
168
170 template<type_visitor V>
172 template<
class V, std::enable_if_t<is_type_visitor_v<V>,
bool> =
true>
174 inline void visit(V&& visitor,
const base_type& type) {
175 type.accept(visitor);
179
180
181
183 template<glsl_type T, type_visitor V>
185 template<
class T,
class V, std::enable_if_t<is_glsl_type_v<T> && is_type_visitor_v<V>,
bool> =
true>
187 inline void visit(V&& visitor,
const T& type) {
188 type.accept(visitor);
194
195
196
198 template<glsl_type T>
200 template<
class T, std::enable_if_t<is_glsl_type_v<T>,
bool> =
true>
207
208
209
211 template<glsl_type T>
213 template<
class T, std::enable_if_t<is_glsl_type_v<T>,
bool> =
true>