diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-02-08 22:48:19 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-02-08 22:48:19 +0100 |
commit | aceb0a84b4abaa4e631d317c6cd0d02b0aa0bdbd (patch) | |
tree | 79d4335c1be282ad6a76bd7834d585ce4418989a /compat | |
parent | 24209b545e061caf601fbdd473936ccba2d95ceb (diff) |
style issues
Diffstat (limited to 'compat')
-rw-r--r-- | compat/vector-wrapper-fwd.hpp | 16 | ||||
-rw-r--r-- | compat/vector-wrapper.hpp | 9 |
2 files changed, 21 insertions, 4 deletions
diff --git a/compat/vector-wrapper-fwd.hpp b/compat/vector-wrapper-fwd.hpp new file mode 100644 index 00000000..4e4ab371 --- /dev/null +++ b/compat/vector-wrapper-fwd.hpp @@ -0,0 +1,16 @@ +#pragma once + +namespace floormat { + +template<typename T> struct vector_wrapper; + +enum class vector_wrapper_repr : uint8_t // todo! use this +{ + invalid, + lvalue_reference_to_vector, + const_reference_to_vector, + vector, + //rvalue_reference_to_vector, +}; + +} // namespace floormat diff --git a/compat/vector-wrapper.hpp b/compat/vector-wrapper.hpp index 1b6f0617..cb6e7549 100644 --- a/compat/vector-wrapper.hpp +++ b/compat/vector-wrapper.hpp @@ -1,4 +1,5 @@ #pragma once +#include "vector-wrapper-fwd.hpp" // todo! #include <vector> namespace floormat { @@ -6,10 +7,10 @@ namespace floormat { template<typename T> struct vector_wrapper final { - using vector_type = std::conditional_t<std::is_const_v<T>, - const std::vector<std::remove_const_t<T>>, - std::vector<T>>; - vector_type& vec; + using vector_type = std::conditional_t<std::is_const_v<T>, const std::vector<std::remove_const_t<T>>, std::vector<T>>; + using qualified_type = std::conditional_t<std::is_const_v<T>, vector_type, vector_type&>; + + qualified_type vec; }; } // namespace floormat |