File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change 1+ #ifndef _NBL_SYSTEM_TO_STRING_INCLUDED_
2+ #define _NBL_SYSTEM_TO_STRING_INCLUDED_
3+
4+ #include < nbl/builtin/hlsl/cpp_compat.hlsl>
5+
6+ namespace nbl
7+ {
8+ namespace system
9+ {
10+ namespace impl
11+ {
12+
13+ template <typename T>
14+ struct to_string_helper
15+ {
16+ static std::string __call (const T& value)
17+ {
18+ return std::to_string (value);
19+ }
20+ };
21+
22+ template <typename T, int16_t N>
23+ struct to_string_helper <hlsl::vector<T, N>>
24+ {
25+ static std::string __call (const hlsl::vector<T, N>& value)
26+ {
27+ std::stringstream output;
28+ output << " { " ;
29+ for (int i = 0 ; i < N; ++i)
30+ {
31+ output << to_string_helper<T>::__call (value[i]);
32+
33+ if (i < N - 1 )
34+ output << " , " ;
35+ }
36+ output << " }" ;
37+
38+ return output.str ();
39+ }
40+ };
41+
42+ }
43+
44+ template <typename T>
45+ std::string to_string (T value)
46+ {
47+ return impl::to_string_helper<T>::__call (value);
48+ }
49+ }
50+ }
51+
52+ #endif
You can’t perform that action at this time.
0 commit comments