From f40bba52c58fdf3d5300ad366f586e0d910c6a64 Mon Sep 17 00:00:00 2001
From: Sandipan Mohanty <s.mohanty@fz-juelich.de>
Date: Sun, 8 May 2022 20:38:27 +0200
Subject: [PATCH] Redirecting headers for format and ranges

---
 code/include/cxx20format | 13 +++++++++++++
 code/include/cxx20ranges | 14 ++++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 code/include/cxx20format
 create mode 100644 code/include/cxx20ranges

diff --git a/code/include/cxx20format b/code/include/cxx20format
new file mode 100644
index 0000000..b880b29
--- /dev/null
+++ b/code/include/cxx20format
@@ -0,0 +1,13 @@
+#include <version>
+#ifdef __cpp_lib_format
+  #include<format>
+  namespace fmt = std;
+  using std::format;
+#elif __has_include (<fmt/format.h>)
+  #define FMT_HEADER_ONLY
+  #include<fmt/core.h>
+  #include<fmt/format.h>
+  using fmt::format;
+  #warning Using external format.h header from the fmt library.
+#endif
+
diff --git a/code/include/cxx20ranges b/code/include/cxx20ranges
new file mode 100644
index 0000000..989fe06
--- /dev/null
+++ b/code/include/cxx20ranges
@@ -0,0 +1,14 @@
+#include <version>
+#ifdef __cpp_lib_ranges
+  #include<ranges>
+  namespace sr = std::ranges;
+  namespace sv = std::views;
+#elif __has_include (<range/v3/all.hpp>)
+  #include<range/v3/all.hpp>
+  namespace sr = ranges;
+  namespace sv = ranges::views;
+  #warning Using rangesv3 3rd party library
+#else
+#error No suitable header for C++20 ranges was found!
+#endif
+
-- 
GitLab