aboutsummaryrefslogtreecommitdiff
path: root/include/openvic-dataloader
diff options
context:
space:
mode:
author Spartan322 <Megacake1234@gmail.com>2023-09-02 15:03:14 +0200
committer Spartan322 <Megacake1234@gmail.com>2023-09-02 19:20:25 +0200
commitdbc66788a680daf3f8a1c0c6e7fbd1b77cc06864 (patch)
tree288a1530b1f3cd2d7ba2bb5821e2c4160725707c /include/openvic-dataloader
parentf990117e56060811ddd2a850ec712485aea79649 (diff)
Add github actions and workflow
Diffstat (limited to 'include/openvic-dataloader')
-rw-r--r--include/openvic-dataloader/csv/LineObject.hpp24
-rw-r--r--include/openvic-dataloader/detail/OptionalConstexpr.hpp9
-rw-r--r--include/openvic-dataloader/detail/VectorConstexpr.hpp9
3 files changed, 31 insertions, 11 deletions
diff --git a/include/openvic-dataloader/csv/LineObject.hpp b/include/openvic-dataloader/csv/LineObject.hpp
index 0494ffb..8a9c2ec 100644
--- a/include/openvic-dataloader/csv/LineObject.hpp
+++ b/include/openvic-dataloader/csv/LineObject.hpp
@@ -10,6 +10,8 @@
#include <tuple>
#include <vector>
+#include <openvic-dataloader/detail/VectorConstexpr.hpp>
+
namespace ovdl::csv {
/// LineObject should be able to recognize the differences between:
/// Input -> Indexes == ""
@@ -30,20 +32,20 @@ namespace ovdl::csv {
using inner_value_type = std::string;
using container_type = std::vector<std::tuple<position_type, inner_value_type>>;
- constexpr LineObject() = default;
- constexpr LineObject(LineObject&) = default;
- constexpr LineObject(LineObject&&) = default;
- constexpr LineObject(const LineObject&) = default;
+ OVDL_VECTOR_CONSTEXPR LineObject() = default;
+ OVDL_VECTOR_CONSTEXPR LineObject(LineObject&) = default;
+ OVDL_VECTOR_CONSTEXPR LineObject(LineObject&&) = default;
+ OVDL_VECTOR_CONSTEXPR LineObject(const LineObject&) = default;
- constexpr LineObject& operator=(const LineObject& other) = default;
- constexpr LineObject& operator=(LineObject&& other) = default;
+ OVDL_VECTOR_CONSTEXPR LineObject& operator=(const LineObject& other) = default;
+ OVDL_VECTOR_CONSTEXPR LineObject& operator=(LineObject&& other) = default;
- constexpr ~LineObject() = default;
+ OVDL_VECTOR_CONSTEXPR ~LineObject() = default;
- constexpr LineObject(std::initializer_list<value_type> pos_and_val) : container_type(pos_and_val) {
+ OVDL_VECTOR_CONSTEXPR LineObject(std::initializer_list<value_type> pos_and_val) : container_type(pos_and_val) {
}
- constexpr LineObject(position_type prefix_end, std::initializer_list<value_type> pos_and_val, position_type suffix_end = 0)
+ OVDL_VECTOR_CONSTEXPR LineObject(position_type prefix_end, std::initializer_list<value_type> pos_and_val, position_type suffix_end = 0)
: container_type(pos_and_val),
_prefix_end(prefix_end),
_suffix_end(suffix_end) {
@@ -77,8 +79,8 @@ namespace ovdl::csv {
private:
// Should be position of first valid value on line
- position_type _prefix_end;
+ position_type _prefix_end = 0;
// Should be position after last value or position after last seperator
- position_type _suffix_end;
+ position_type _suffix_end = 0;
};
} \ No newline at end of file
diff --git a/include/openvic-dataloader/detail/OptionalConstexpr.hpp b/include/openvic-dataloader/detail/OptionalConstexpr.hpp
new file mode 100644
index 0000000..bcb12a7
--- /dev/null
+++ b/include/openvic-dataloader/detail/OptionalConstexpr.hpp
@@ -0,0 +1,9 @@
+#pragma once
+
+// THANK YOU APPLE FOR YOUR UTTER DISREGARD FOR C++20
+
+#if __cpp_lib_optional >= 202106L
+#define OVDL_OPTIONAL_CONSTEXPR constexpr
+#else
+#define OVDL_OPTIONAL_CONSTEXPR inline
+#endif \ No newline at end of file
diff --git a/include/openvic-dataloader/detail/VectorConstexpr.hpp b/include/openvic-dataloader/detail/VectorConstexpr.hpp
new file mode 100644
index 0000000..7e7fa34
--- /dev/null
+++ b/include/openvic-dataloader/detail/VectorConstexpr.hpp
@@ -0,0 +1,9 @@
+#pragma once
+
+// THANK YOU APPLE FOR YOUR UTTER DISREGARD FOR C++20
+
+#if __cpp_lib_constexpr_vector >= 201907L
+#define OVDL_VECTOR_CONSTEXPR constexpr
+#else
+#define OVDL_VECTOR_CONSTEXPR inline
+#endif \ No newline at end of file