2
3
4
5
6
7
8
11#ifndef _GLSL_STRUCT_GLSL_TYPE_HPP_
12 #define _GLSL_STRUCT_GLSL_TYPE_HPP_
14 #include <glslstruct/config.hpp>
18 "This is only available for c++17 and greater and when types are not disabled with defined GLSL_STRUCT_DISABLE_TYPES!"
22 #include <glslstruct/type/containers/base_type.hpp>
23 #include <glslstruct/type/visitors/eq_type_visitor.hpp>
27
28
29
30
31 template<
class Derived>
39 void _accept(
const mstd::function_view<
void(
const scalar_type&)> scalarVisit,
40 const mstd::function_view<
void(
const vec_type&)> vecVisit,
const mstd::function_view<
void(
const mat_type&)> matVisit,
41 const mstd::function_view<
void(
const struct_type&)> structVisit,
42 const mstd::function_view<
void(
const array_type&)> arrayVisit)
const override {
43 if _MSTD_CONSTEXPR17 (std::is_same_v<Derived, scalar_type>) { scalarVisit(_get_derived()); }
44 else if _MSTD_CONSTEXPR17 (std::is_same_v<Derived, vec_type>) { vecVisit(_get_derived()); }
45 else if _MSTD_CONSTEXPR17 (std::is_same_v<Derived, mat_type>) { matVisit(_get_derived()); }
46 else if _MSTD_CONSTEXPR17 (std::is_same_v<Derived, struct_type>) { structVisit(_get_derived()); }
47 else if _MSTD_CONSTEXPR17 (std::is_same_v<Derived, array_type>) { arrayVisit(_get_derived()); }
51 using base_type::operator!=;
70 template<type_visitor T>
72 template<
class T, std::enable_if_t<is_type_visitor_v<T>,
bool> =
true>
74 void accept(T& visitor)
const {
75 visitor.visit(_get_derived());
79 [[nodiscard]]
bool operator==(
const base_type& other)
const noexcept override {
80 if (!base_type::operator==(other)) {
return false; }
82 eq_type_visitor<Derived> visitor(&_get_derived());
83 other.accept(visitor);
84 return visitor.result();
87 template<
class DerivedA,
class DerivedB>
89 template<
class DerivedA,
class DerivedB>
94
95
96
97 template<
class DerivedA,
class DerivedB>
99 const type<DerivedB>& rhs)
noexcept {
101 else {
return false; }
105
106
107
108 template<
class DerivedA,
class DerivedB>
110 const type<DerivedB>& rhs)
noexcept {
#define _GLSL_STRUCT_EXPORT
This is for exporting symbols in shared library setup.
Definition config.hpp:251
#define _GLSL_STRUCT_CONSTEXPR20
constexpr keyword for c++20 and higher
Definition config.hpp:213
#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
#define _GLSL_STRUCT_CONSTEXPR17
constexpr for c++17 and higher
Definition config.hpp:196
Main namespace of glslstruct library.
Definition contexts.hpp:20