Circus 0.0.1-alpha
C++ Serialization Framework
Loading...
Searching...
No Matches
cxpr_stream.hpp
Go to the documentation of this file.
1
5
6#pragma once
7#include <algorithm>
8#include <iostream>
9
10namespace circus::utils {
11
23template <const std::string_view &...args>
25 public:
27 constexpr static std::size_t size = (args.size() + ... + 0);
28
29 private:
31 constexpr static std::array<char, size> arr = []<typename... Args>(Args &&...as) consteval {
32 std::array<char, size> arr;
33 std::size_t index = 0;
34 (std::for_each(as.begin(), as.end(), [&](char c) { arr[index++] = c; }),
35 ...);
36 return arr;
37 }(std::forward<const std::string_view &>(args)...);
38
39 public:
41 constexpr static std::string_view value{arr.begin(), arr.end()};
42};
43
44} // namespace circus::utils
Compile-time concatenation of multiple string_views into a single string_view.
Definition cxpr_stream.hpp:24
static constexpr std::string_view value
The concatenated string_view spanning the static array.
Definition cxpr_stream.hpp:41
static constexpr std::size_t size
Total size of the concatenated string_view.
Definition cxpr_stream.hpp:27