FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
string.hpp
1// FEAT3: Finite Element Analysis Toolbox, Version 3
2// Copyright (C) 2010 by Stefan Turek & the FEAT group
3// FEAT3 is released under the GNU General Public License version 3,
4// see the file 'copyright.txt' in the top level directory for details.
5
6#pragma once
7
8// includes, FEAT
10#include <kernel/util/half.hpp>
11
12// includes, system
13#include <locale>
14#include <string>
15#include <sstream>
16#include <vector>
17#include <deque>
18#include <iomanip>
19#include <cstddef>
20
21#ifdef FEAT_COMPILER_MICROSOFT
22# include <string.h> // for _stricmp
23#endif
24
25#ifndef __CUDACC__
26#ifdef FEAT_HAVE_QUADMATH
27extern "C"
28{
29# include <quadmath.h>
30}
31#endif // FEAT_HAVE_QUADMATH
32#endif // __CUDACC__
33
34namespace FEAT
35{
44 class String
45 : public std::string
46 {
47 public:
62 {
63 public:
73 bool operator()(const String& left, const String& right) const
74 {
75 return left.compare_no_case(right) < 0;
76 }
77 }; // class NoCaseLess
78
79 public:
81 inline String()
82 : std::string()
83 {
84 }
85
87 inline String(const char* str)
88 : std::string(str)
89 {
90 }
91
93 inline String(const char* str, size_type count)
94 : std::string(str, count)
95 {
96 }
97
99 inline String(const std::string& str)
100 : std::string(str)
101 {
102 }
103
104#ifndef __CUDACC__
106 inline String(std::string&& str)
107 : std::string(str)
108 {
109 }
110#endif
111
113 inline String(const String& str)
114 : std::string(str)
115 {
116 }
117
118#ifndef __CUDACC__
120 inline String(String&& str)
121 : std::string(str)
122 {
123 }
124#endif
125
127 inline String(const std::string& str, size_type offset, size_type count = npos)
128 : std::string(str, offset, count)
129 {
130 }
131
133 inline String(size_type count, char c)
134 : std::string(count, c)
135 {
136 }
137
139 String& operator=(const std::string& str)
140 {
141 std::string::operator=(str);
142 return *this;
143 }
144
145#ifndef __CUDACC__
146 String& operator=(std::string&& str)
147 {
148 std::string::operator=(str);
149 return *this;
150 }
151#endif
152
153 String& operator=(const String& str)
154 {
155 std::string::operator=(str);
156 return *this;
157 }
158
159#ifndef __CUDACC__
160 String& operator=(String&& str)
161 {
162 std::string::operator=(str);
163 return *this;
164 }
165#endif
166
167 String& operator=(const char* s)
168 {
169 std::string::operator=(s);
170 return *this;
171 }
172
173 String& append(const std::string& str)
174 {
175 std::string::append(str);
176 return *this;
177 }
178
179 String& append(const std::string& str, size_type pos, size_type n)
180 {
181 std::string::append(str, pos, n);
182 return *this;
183 }
184
185 String& append(const char* s, size_type n)
186 {
187 std::string::append(s, n);
188 return *this;
189 }
190
191 String& append(const char* s)
192 {
193 std::string::append(s);
194 return *this;
195 }
196
197 String& append(size_type n, char c)
198 {
199 std::string::append(n, c);
200 return *this;
201 }
202
203 String& operator+=(const std::string& str)
204 {
205 return append(str);
206 }
207
208 String& operator+=(const char* s)
209 {
210 return append(s);
211 }
212
213 String substr(size_type pos = size_type(0), size_type n = npos) const
214 {
215 return String(std::string::substr(pos, n));
216 }
218
222 static const char* whitespaces()
223 {
224 return " \a\b\f\n\r\t\v";
225 }
226
233 void push_front(char value)
234 {
235 insert(size_type(0), size_type(1), value);
236 }
237
240 {
241 erase(size_type(0), size_type(1));
242 }
243
245 void pop_back()
246 {
247 erase(size() - size_type(1), size_type(1));
248 }
249
261 String trim_front(const String & charset) const
262 {
263 // find first character not to be trimmed
264 size_type pos = find_first_not_of(charset);
265 if(pos == npos)
266 return String();
267 else
268 return substr(pos);
269 }
270
278 {
279 return trim_front(whitespaces());
280 }
281
293 String trim_back(const String & charset) const
294 {
295 // find last character not to be trimmed
296 size_type pos = find_last_not_of(charset);
297 if(pos == npos)
298 return String();
299 else
300 return substr(size_type(0), pos + size_type(1));
301 }
302
310 {
311 return trim_back(whitespaces());
312 }
313
327 String trim(const String & charset) const
328 {
329 // trim front and back
330 return trim_front(charset).trim_back(charset);
331 }
332
341 String trim() const
342 {
343 return trim(whitespaces());
344 }
345
358 String& trim_me(const String & charset)
359 {
360 return (*this = trim(charset));
361 }
362
371 {
372 return (*this = trim());
373 }
374
392 String pad_front(size_type len, char c = ' ') const
393 {
394 size_type l(length());
395 return (l < len) ? String(len - l, c).append(*this) : *this;
396 }
397
415 String pad_back(size_type len, char c = ' ') const
416 {
417 size_type l(length());
418 return (l < len) ? String(*this).append(len - l, c) : *this;
419 }
420
430 String trunc_front(size_type len) const
431 {
432 return length() <= len ? *this : substr(length() - len);
433 }
434
444 String trunc_back(size_type len) const
445 {
446 return length() <= len ? *this : substr(size_type(0), len);
447 }
448
467 std::deque<String> split_by_charset(const String & charset) const
468 {
469 std::deque<String> words;
470 if(empty() || charset.empty())
471 {
472 return words;
473 }
474
475 // find first occurrence of split substring
476 size_type off1(find_first_not_of(charset));
477 if(off1 == npos)
478 {
479 // only delimiter characters; nothing to be extracted
480 return words;
481 }
482
483 // go splitting
484 while(off1 != npos)
485 {
486 // find next occurrence of delimiter string
487 size_type off2(find_first_of(charset, off1));
488
489 // add next split substring to vector
490 if(off2 == npos)
491 {
492 // extract last substring
493 words.push_back(substr(off1));
494 return words;
495 }
496 else
497 {
498 // extract next substring
499 words.push_back(substr(off1, (off2 == npos ? npos : off2 - off1)));
500 }
501
502 // find next occurrence of split substring
503 off1 = find_first_not_of(charset, off2);
504 }
505
506 // okay
507 return words;
508 }
509
518 std::deque<String> split_by_whitespaces() const
519 {
521 }
522
539 std::deque<String> split_by_string(const String & delimiter) const
540 {
541 std::deque<String> words;
542 if(empty() || delimiter.empty())
543 return words;
544
545 // find first occurrence of delimiter substring
546 size_type off1(find(delimiter));
547 words.push_back(substr(0, off1));
548 if(off1 == npos)
549 return words;
550
551 // go splitting
552 const size_type del_len(delimiter.size());
553 while(off1 != npos)
554 {
555 // increase leading offset by delimiter length
556 off1 += del_len;
557
558 // find next substring occurrence
559 size_type off2 = find(delimiter, off1);
560 if(off2 == npos)
561 {
562 // extract last substring
563 words.push_back(substr(off1));
564 return words;
565 }
566 else
567 {
568 // extract next substring
569 words.push_back(substr(off1, off2 - off1));
570 }
571
572 // update offset
573 off1 = off2;
574 }
575
576 // okay
577 return words;
578 }
579
598 size_type replace_all(const String & find_string, const String & replace_string)
599 {
600 size_type flen(find_string.size());
601 size_type rlen(replace_string.size());
602 if(flen <= 0)
603 return size_type(0);
604
605 // find first occurrence of find string
606 size_type pos(find(find_string));
607 size_type counter(size_type(0));
608 while(pos != npos)
609 {
610 // replace substring
611 replace(pos, flen, replace_string);
612
613 // increment counter
614 ++counter;
615
616 // find next occurrence
617 pos = find(find_string, pos + rlen);
618 }
619
620 // return replacement count
621 return counter;
622 }
623
630 String upper() const
631 {
632 String str;
633 str.reserve(size());
634 for(const_iterator it(begin()); it != end(); ++it)
635 {
636#ifdef FEAT_COMPILER_MICROSOFT
637 str.push_back(std::toupper(*it, std::locale::classic()));
638#else
639 std::locale loc;
640 str.push_back(std::toupper<char>(*it, loc));
641#endif
642 }
643 return str;
644 }
645
652 String lower() const
653 {
654 String str;
655 str.reserve(size());
656 for(const_iterator it(begin()); it != end(); ++it)
657 {
658#ifdef FEAT_COMPILER_MICROSOFT
659 str.push_back(std::tolower(*it, std::locale::classic()));
660#else
661 std::locale loc;
662 str.push_back(std::tolower<char>(*it, loc));
663#endif
664 }
665 return str;
666 }
667
679 int compare_no_case(const String& other) const
680 {
681#ifdef FEAT_COMPILER_MICROSOFT
682 // The MS C library offers a function for this task.
683 return _stricmp(c_str(), other.c_str());
684#else
685 // reference implementation
686 std::locale loc;
687 size_type n1 = size();
688 size_type n2 = other.size();
689 size_type n = std::min(n1, n2);
690
691 // loop over all characters and compare them
692 for(size_type i = 0; i < n; ++i)
693 {
694 int k = int(std::tolower<char>((*this)[i], loc)) - int(std::tolower<char>(other[i], loc));
695 if(k < 0)
696 {
697 return -1;
698 }
699 else if(k > 0)
700 {
701 return 1;
702 }
703 }
704
705 // If we come out here, then both strings are identical for the first n characters.
706 // Now let's check whether their length is equal, too.
707 if(n1 < n2)
708 {
709 return -1;
710 }
711 else if(n1 > n2)
712 {
713 return 1;
714 }
715 else
716 {
717 return 0;
718 }
719#endif
720 }
721
731 bool starts_with(const String& head) const
732 {
733 // every string starts with an empty string
734 if(head.empty())
735 return true;
736
737 // check size
738 if(this->size() < head.size())
739 return false;
740
741 // compare head
742 return (this->compare(std::size_t(0), head.size(), head) == 0);
743 }
744
754 bool ends_with(const String& tail) const
755 {
756 // every string ends with an empty string
757 if(tail.empty())
758 return true;
759
760 // check size
761 if(this->size() < tail.size())
762 return false;
763
764 // compare tail
765 return (this->compare(this->size() - tail.size(), tail.size(), tail) == 0);
766 }
767
777 bool starts_with(const char head) const
778 {
779 return (this->empty() ? false : this->front() == head);
780 }
781
791 bool ends_with(const char tail) const
792 {
793 return (this->empty() ? false : this->back() == tail);
794 }
795
811 bool is_one_of(const String& set, const String& sep = " ", bool case_insensitive = false) const
812 {
813 std::deque<String> sset = set.split_by_string(sep);
814 for(const auto& s : sset)
815 {
816 if(case_insensitive)
817 {
818 if(this->compare_no_case(s) == 0)
819 return true;
820 }
821 else if(this->compare(s) == 0)
822 return true;
823 }
824 return false;
825 }
826
836 template<typename T_>
837 bool parse(T_& t) const
838 {
839 std::istringstream iss(trim());
840 iss >> t;
841 return !iss.fail();
842 }
843
845 bool parse(bool& b) const
846 {
847 if(trim().compare_no_case("true") == 0)
848 {
849 b = true;
850 return true;
851 }
852 if(trim().compare_no_case("false") == 0)
853 {
854 b = false;
855 return true;
856 }
857 return false;
858 }
859
860 bool parse(std::string& s) const
861 {
862 s.assign(*this);
863 return true;
864 }
865
866 // This one is really required, as otherwise some compilers choose the
867 // generic template instead of the overload for std::string above...
868 bool parse(String& s) const
869 {
870 s.assign(*this);
871 return true;
872 }
873
874 #ifdef FEAT_HAVE_HALFMATH
875 bool parse(Half& t)
876 {
877 float tmp;
878 bool ret = parse(tmp);
879 t = __float2half(tmp);
880 return ret;
881 }
882 #endif
883
884#ifndef __CUDACC__
885#ifdef FEAT_HAVE_QUADMATH
886 bool parse(__float128& x) const
887 {
888 if(this->empty())
889 return false;
890
891 const char* nptr(this->c_str());
892 char* endptr(nullptr);
893 x = strtoflt128(nptr, &endptr);
894 // Note: According to the C-Standard (ISO/IEC 9899:1190 (E), 7.10.1.4 The strod function),
895 // the 'strtod' function sets 'endptr' to 'nptr' if the conversion fails, so we simply
896 // hope that the quadmath function for __float128 honors this convention...
897 return (nptr != endptr);
898 }
899#endif // FEAT_HAVE_QUADMATH
900#endif // __CUDACC__
902 }; // class String
903
905 inline String operator+(const String& a, const String& b)
906 {
907 return String(a).append(b);
908 }
909
910 inline String operator+(const char* a, const String& b)
911 {
912 return String(a).append(b);
913 }
914
915 inline String operator+(const String& a, const char* b)
916 {
917 return String(a).append(b);
918 }
919
920 inline String operator+(const String& a, char c)
921 {
922 return String(a).append(String::size_type(1), c);
923 }
924
925 inline String operator+(char c, const String& b)
926 {
927 return String(String::size_type(1), c).append(b);
928 }
930
943 template<typename T_>
944 inline String stringify(const T_& item)
945 {
946 std::ostringstream oss;
947 oss << item;
948 return oss.str();
949 }
950
952 inline String stringify(const char* item)
953 {
954 return String(item);
955 }
956
957 inline String stringify(const std::string& item)
958 {
959 return item;
960 }
961
962 inline String stringify(char item)
963 {
964 return String(1, item);
965 }
966
967 inline String stringify(bool item)
968 {
969 return String(item ? "true" : "false");
970 }
971
972#ifdef FEAT_HAVE_HALFMATH
973 inline String stringify(const Half& item)
974 {
975 return stringify(__half2float(item));
976 }
977#endif
978
979#ifndef __CUDACC__
980 inline String stringify(std::nullptr_t)
981 {
982 return String("nullptr");
983 }
984
985#ifdef FEAT_HAVE_QUADMATH
986 inline String stringify(__float128 value)
987 {
988 // get buffer length
989 int len = ::quadmath_snprintf(nullptr, 0, "%Qg", value);
990 // allocate buffer
991 std::vector<char> buffer(len+16);
992 // print to buffer
993 quadmath_snprintf(buffer.data(), buffer.size(), "%Qg", value);
994 // convert buffer to string
995 return String(buffer.data());
996 }
997#endif // FEAT_HAVE_QUADMATH
998#endif // __CUDACC__
1000
1016 template<typename Iterator_>
1018 Iterator_ first,
1019 Iterator_ last,
1020 const String & delimiter = "")
1021 {
1022 if(first == last)
1023 return String();
1024
1025 Iterator_ it(first);
1026 String str = stringify(*it);
1027
1028 for(++it; it != last; ++it)
1029 str.append(delimiter).append(stringify(*it));
1030
1031 return str;
1032 }
1033
1049 template<typename Container_>
1051 const Container_& container,
1052 const String & delimiter = "")
1053 {
1054 return stringify_join(container.cbegin(), container.cend(), delimiter);
1055 }
1056
1087 template<typename DataType_>
1088 inline String stringify_fp_sci(DataType_ value, int precision = 0, int width = 0, bool sign = false)
1089 {
1090 std::ostringstream oss;
1091 oss << std::scientific;
1092 if(precision > 0)
1093 oss << std::setprecision(precision);
1094 if(width > 0)
1095 oss << std::setw(width);
1096 if(sign)
1097 oss << std::showpos;
1098 oss << value;
1099 return oss.str();
1100 }
1101
1102 #ifdef FEAT_HAVE_HALFMATH
1104 inline String stringify_fp_sci(Half value, int precision = 0, int width = 0, bool sign = false)
1105 {
1106 return stringify_fp_sci(__half2float(value), precision, width, sign);
1107 }
1109 #endif
1110
1141 template<typename DataType_>
1142 inline String stringify_fp_fix(DataType_ value, int precision = 0, int width = 0, bool sign = false)
1143 {
1144 std::ostringstream oss;
1145 oss << std::fixed;
1146 if(precision > 0)
1147 oss << std::setprecision(precision);
1148 if(width > 0)
1149 oss << std::setw(width);
1150 if(sign)
1151 oss << std::showpos;
1152 oss << value;
1153 return oss.str();
1154 }
1155
1156 #ifdef FEAT_HAVE_HALFMATH
1158 inline String stringify_fp_fix(Half value, int precision = 0, int width = 0, bool sign = false)
1159 {
1160 return stringify_fp_fix(__half2float(value), precision, width, sign);
1161 }
1163 #endif
1164
1165#ifndef __CUDACC__
1166#ifdef FEAT_HAVE_QUADMATH
1167 inline String stringify_fp_sci(__float128 value, int precision = 0, int width = 0, bool sign = false)
1168 {
1169 String format("%");
1170 if(sign)
1171 format.append("+");
1172 if(width > 0)
1173 format.append(stringify(width));
1174 if(precision > 0)
1175 {
1176 format.append(".");
1177 format.append(stringify(precision));
1178 }
1179 format.append("Qe");
1180 // get buffer length
1181 int len = ::quadmath_snprintf(nullptr, 0, format.c_str(), value);
1182 // allocate buffer
1183 std::vector<char> buffer(len+16);
1184 // print to buffer
1185 quadmath_snprintf(buffer.data(), buffer.size(), format.c_str(), value);
1186 // convert buffer to string
1187 return String(buffer.data());
1188 }
1189
1190 inline String stringify_fp_fix(__float128 value, int precision = 0, int width = 0, bool sign = false)
1191 {
1192 String format("%");
1193 if(sign)
1194 format.append("+");
1195 if(width > 0)
1196 format.append(stringify(width));
1197 if(precision > 0)
1198 {
1199 format.append(".");
1200 format.append(stringify(precision));
1201 }
1202 format.append("Qf");
1203 // get buffer length
1204 int len = ::quadmath_snprintf(nullptr, 0, format.c_str(), value);
1205 // allocate buffer
1206 std::vector<char> buffer(len+16);
1207 // print to buffer
1208 quadmath_snprintf(buffer.data(), buffer.size(), format.c_str(), value);
1209 // convert buffer to string
1210 return String(buffer.data());
1211 }
1212
1213 inline std::istream& operator>>(std::istream& is, __float128& x)
1214 {
1215 String buffer;
1216 // try to parse a string
1217 if(!(is >> buffer).fail())
1218 {
1219 if(!buffer.parse(x))
1220 {
1221 // parse failed, so put back the string
1222 for(std::size_t i(0); i < buffer.size(); ++i)
1223 is.putback(buffer.at(i));
1224
1225 // set failbit
1226 is.setstate(std::ios_base::failbit);
1227 }
1228 }
1229 return is;
1230 }
1231#endif // FEAT_HAVE_QUADMATH
1232#endif // __CUDACC__
1233
1261 inline String stringify_bytes(std::uint64_t bytes, int precision = 3, int width = 7)
1262 {
1263 // the bounds are chosen such that the output will never have more than 3 leading digits
1264 if(bytes <= 999ull)
1265 return stringify(bytes).pad_front(std::size_t(width)) + " Bytes";
1266 else if(bytes <= 1'022'976ull) // = 999*1024
1267 return stringify_fp_fix(double(bytes) / (1024.), precision, width) + " KiB";
1268 else if(bytes <= 1'047'527'424ull) // = 999*1024^2
1269 return stringify_fp_fix(double(bytes) / (1048576.), precision, width) + " MiB";
1270 else if(bytes <= 1'072'668'082'176ull) // = 999*1024^3
1271 return stringify_fp_fix(double(bytes) / (1073741824.), precision, width) + " GiB";
1272 else if(bytes <= 1'098'412'116'148'224ull) // = 999*1024^4
1273 return stringify_fp_fix(double(bytes) / (1099511627776.), precision, width) + " TiB";
1274 else
1275 return stringify_fp_fix(double(bytes) / (1125899906842624.), precision, width) + " PiB";
1276 }
1277} // namespace FEAT
1278
1279// operator<<(__float128) must reside in the std namespace because gcc/icc search the namespace of ostream for a fitting op<< first
1280// and would otherwise only find op<< with conversions of __float128 to int/double/long etc, which would lead to ambiguous overloads, too.
1281#ifndef __CUDACC__
1282#ifdef FEAT_HAVE_QUADMATH
1283namespace std
1284{
1285 inline std::ostream& operator<<(std::ostream& os, __float128 x)
1286 {
1287 // write to stream
1288 return (os << FEAT::stringify(x));
1289 }
1290}
1291#endif // FEAT_HAVE_QUADMATH
1292#endif // __CUDACC__
FEAT Kernel base header.
A class providing case-insensitive String comparison.
Definition: string.hpp:62
bool operator()(const String &left, const String &right) const
Compares two Strings without regard to case.
Definition: string.hpp:73
String class implementation.
Definition: string.hpp:46
String trunc_front(size_type len) const
Truncates the front of the string to a given maximum length.
Definition: string.hpp:430
void pop_front()
Removes the first character from the string.
Definition: string.hpp:239
String trim() const
Trims the string of all white-spaces.
Definition: string.hpp:341
bool parse(T_ &t) const
Parses the string and stores its value in the provided variable.
Definition: string.hpp:837
String trim_back(const String &charset) const
Trims the back of the string.
Definition: string.hpp:293
String & trim_me()
Trims this string of all white-spaces.
Definition: string.hpp:370
std::deque< String > split_by_string(const String &delimiter) const
Splits the string by a delimiter substring.
Definition: string.hpp:539
String trim_front() const
Trims the front of the string of all white-spaces.
Definition: string.hpp:277
String trim_back() const
Trims the back of the string of all white-spaces.
Definition: string.hpp:309
String trunc_back(size_type len) const
Truncates the back of the string to a given maximum length.
Definition: string.hpp:444
String(std::string &&str)
CTOR.
Definition: string.hpp:106
String(const String &str)
copy CTOR
Definition: string.hpp:113
static const char * whitespaces()
Returns a null-terminated char string containing all white-space characters.
Definition: string.hpp:222
String(const char *str, size_type count)
CTOR.
Definition: string.hpp:93
std::deque< String > split_by_whitespaces() const
Splits the string by white-spaces.
Definition: string.hpp:518
int compare_no_case(const String &other) const
Compares two strings without regard to case.
Definition: string.hpp:679
bool ends_with(const char tail) const
Checks whether this string ends with a specified character.
Definition: string.hpp:791
String trim_front(const String &charset) const
Trims the front of the string.
Definition: string.hpp:261
bool starts_with(const char head) const
Checks whether this string starts with a specified character.
Definition: string.hpp:777
String pad_back(size_type len, char c=' ') const
Pads the back of the string up to a desired length.
Definition: string.hpp:415
bool ends_with(const String &tail) const
Checks whether this string ends with another string.
Definition: string.hpp:754
std::deque< String > split_by_charset(const String &charset) const
Splits the string by a delimiter charset.
Definition: string.hpp:467
String & trim_me(const String &charset)
Trims this string.
Definition: string.hpp:358
void pop_back()
Removes the last character from the string.
Definition: string.hpp:245
bool starts_with(const String &head) const
Checks whether this string starts with another string.
Definition: string.hpp:731
String(const char *str)
CTOR.
Definition: string.hpp:87
String(const std::string &str)
CTOR.
Definition: string.hpp:99
String()
default constructor
Definition: string.hpp:81
String(String &&str)
move CTOR
Definition: string.hpp:120
String(const std::string &str, size_type offset, size_type count=npos)
CTOR.
Definition: string.hpp:127
String pad_front(size_type len, char c=' ') const
Pads the front of the string up to a desired length.
Definition: string.hpp:392
size_type replace_all(const String &find_string, const String &replace_string)
Replaces all occurrences of a substring by another substring.
Definition: string.hpp:598
String trim(const String &charset) const
Trims the string.
Definition: string.hpp:327
void push_front(char value)
Inserts a character at the front of the string.
Definition: string.hpp:233
String upper() const
Converts the string to upper case.
Definition: string.hpp:630
String(size_type count, char c)
CTOR.
Definition: string.hpp:133
bool is_one_of(const String &set, const String &sep=" ", bool case_insensitive=false) const
Checks whether this string is equal to one in a set of strings.
Definition: string.hpp:811
String lower() const
Converts the string to lower case.
Definition: string.hpp:652
std::istream & operator>>(std::istream &is, Pack::Type &t)
stream input operator for Pack::Type
Definition: pack.hpp:189
CUDA_HOST_DEVICE Vector< T_, n_ > operator+(const Vector< T_, n_, sa_ > &a, const Vector< T_, n_, sb_ > &b)
vector addition operator
FEAT namespace.
Definition: adjactor.hpp:12
String stringify_fp_fix(DataType_ value, int precision=0, int width=0, bool sign=false)
Prints a floating point value to a string in fixed-point notation.
Definition: string.hpp:1142
String stringify(const T_ &item)
Converts an item into a String.
Definition: string.hpp:944
String stringify_join(Iterator_ first, Iterator_ last, const String &delimiter="")
Joins a sequence of strings.
Definition: string.hpp:1017
__half Half
Half data type.
Definition: half.hpp:25
String stringify_bytes(std::uint64_t bytes, int precision=3, int width=7)
Prints a byte size to a string using the common units Bytes, KiB, MiB, Gib, TiB or PiB.
Definition: string.hpp:1261
String stringify_fp_sci(DataType_ value, int precision=0, int width=0, bool sign=false)
Prints a floating point value to a string in scientific notation.
Definition: string.hpp:1088
@ value
specifies whether the space should supply basis function values