16 template<
typename In,
typename Out>
26 template<
class ForwardIt1,
class ForwardIt2>
27 constexpr
auto constexprSearch(ForwardIt1 first, ForwardIt1 last, ForwardIt2 sFirst, ForwardIt2 sLast)
32 ForwardIt1 it = first;
33 for(ForwardIt2 sIt = sFirst;; ++it, ++sIt)
48 template<
class InputIt,
class OutputIt,
class T>
49 constexpr
auto constexprRemoveCopy(InputIt first, InputIt last, OutputIt d_first,
const T& value) -> OutputIt
51 for(; first != last; ++first)
53 if(!(*first == value))
63 template<
class InputIt,
class T>
65 typename std::iterator_traits<InputIt>::difference_type
67 typename std::iterator_traits<InputIt>::difference_type ret = 0;
68 for(; first != last; ++first)
78 template<std::
size_t NewSize,
typename T, std::
size_t N>
116 #if defined(__clang__)
117 constexpr
auto prefix = std::string_view{
"[T = "};
118 constexpr
auto suffix = std::string_view{
"]"};
119 constexpr
auto function = std::string_view{__PRETTY_FUNCTION__};
120 #elif defined(__GNUC__)
121 constexpr
auto prefix = std::string_view{
"with T = "};
122 constexpr
auto suffix = std::string_view{
"]"};
123 constexpr
auto function = std::string_view{__PRETTY_FUNCTION__};
124 #elif defined(_MSC_VER)
125 constexpr
auto prefix = std::string_view{
"typeNameAsArray<"};
126 constexpr
auto suffix = std::string_view{
">(void)"};
127 constexpr
auto function = std::string_view{__FUNCSIG__};
129 # warning Unsupported compiler
130 constexpr
auto prefix = std::string_view{};
131 constexpr
auto suffix = std::string_view{};
132 constexpr
auto function = std::string_view{};
135 constexpr
auto start =
function.find(prefix) + prefix.size();
136 constexpr
auto end =
function.rfind(suffix);
137 static_assert(start <= end);
139 constexpr
auto name =
function.substr(start, (end - start));
141 constexpr
auto arrAndSize = [&]() constexpr
151 auto removeAllOccurences = [](
auto& nameArray, std::size_t size, std::string_view str) constexpr
153 auto e = nameArray.begin() + size;
156 auto it =
constexprSearch(nameArray.begin(), e, str.begin(), str.end());
162 return e - nameArray.begin();
165 auto size = removeAllOccurences(nameArray, nameArray.size(), std::string_view{
"struct "});
166 size = removeAllOccurences(nameArray, size, std::string_view{
"class "});
168 auto size = nameArray.size();
174 auto e = nameArray.begin() + size;
175 for(
auto b = nameArray.begin(); b < e - 2; b++)
177 if((b[0] ==
'>' && b[1] ==
' ' && b[2] ==
'>') || (b[0] ==
',' && b[1] ==
' '))
183 size = e - nameArray.begin();
186 return std::pair{nameArray, size};
189 return resizeArray<arrAndSize.second>(arrAndSize.first);
200 constexpr
auto& value = internal::typeNameStorage<T>;
201 return std::string_view{value.data(), value.size()};
208 if(c >=
'A' && c <=
'Z')
210 if(c >=
'a' && c <=
'z')
212 if(c >=
'0' && c <=
'9')
223 constexpr
auto arrAndSize = []() constexpr
225 auto s = internal::typeNameStorage<T>;
229 #if defined(__clang__)
230 constexpr
auto anonNs = std::string_view{
"(anonymous namespace)::"};
231 #elif defined(__NVCOMPILER)
232 constexpr
auto anonNs = std::string_view{
"<unnamed>::"};
233 #elif defined(__GNUG__)
234 constexpr
auto anonNs = std::string_view{
"{anonymous}::"};
235 #elif defined(_MSC_VER)
236 constexpr
auto anonNs = std::string_view{
"`anonymous-namespace'::"};
238 constexpr
auto anonNs = std::string_view{
"@"};
241 while((pos = std::string_view(b, e - b).find(anonNs)) != std::string::npos)
251 while(l + 1 < e && !(l[0] ==
':' && l[1] ==
':'))
268 return std::pair{s, e - s.begin()};
271 return resizeArray<arrAndSize.second>(arrAndSize.first);
279 constexpr
auto& value = internal::structNameStorage<T>;
280 return std::string_view{&value[0], value.size()};
296 template<
typename RecordDim, std::size_t... Coords>
302 constexpr
auto size = [&]() constexpr
305 mp_for_each_inline<Tags>(
308 using Tag = decltype(tag);
309 if constexpr(isRecordCoord<Tag>)
312 static_assert(Tag::size == 1);
328 mp_for_each_inline<Tags>(
329 [&](
auto tag) constexpr
331 using Tag = decltype(tag);
332 if constexpr(isRecordCoord<Tag>)
361 if(!a.empty() && a.back() == 0)
362 throw std::logic_error{
"Implementation error: Array should have been completely overwritten."};
371 template<
typename RecordDim, std::size_t... Coords>
375 return std::string_view{value.data(), value.size()};
379 template<
typename RecordDim>
constexpr auto constexprSearch(ForwardIt1 first, ForwardIt1 last, ForwardIt2 sFirst, ForwardIt2 sLast) -> ForwardIt1
auto constexprCount(InputIt first, InputIt last, const T &value) -> typename std::iterator_traits< InputIt >::difference_type
constexpr auto constexprCopy(In f, In l, Out d) -> Out
constexpr auto structNameStorage
constexpr auto resizeArray(Array< T, N > a)
constexpr auto typeNameStorage
constexpr auto typeNameAsArray()
constexpr auto isIdentChar(char c) -> bool
constexpr auto recordCoordTagsStorage
constexpr auto intToStrSize(std::size_t s)
constexpr auto constexprRemoveCopy(InputIt first, InputIt last, OutputIt d_first, const T &value) -> OutputIt
constexpr auto qualifiedTypeName
typename internal::GetTagsImpl< RecordDim, RecordCoord >::type GetTags
constexpr auto structName(T={}) -> std::string_view
constexpr auto prettyRecordCoord(RecordCoord< Coords... >={}) -> std::string_view
constexpr auto begin() -> T *
constexpr auto size() const