\hypertarget{fakestd_8cpp_source}{}\doxysection{fakestd.\+cpp} \label{fakestd_8cpp_source}\index{tests/fakestd.cpp@{tests/fakestd.cpp}} \mbox{\hyperlink{fakestd_8cpp}{Go to the documentation of this file.}} \begin{DoxyCode}{0} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00001}00001 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{fakestd_8h}{kblib/fakestd.h}}"{}}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00002}00002 \textcolor{preprocessor}{\#include "{}catch.hpp"{}}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00003}00003 } \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00004}00004 \textcolor{keyword}{template} <\textcolor{keyword}{class}... Args>} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00005}\mbox{\hyperlink{struct_ref}{00005}} \textcolor{keyword}{struct }\mbox{\hyperlink{struct_ref}{Ref}} \{} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00006}00006 } \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00007}\mbox{\hyperlink{struct_ref_a9110bf9f5cb789920e4e9c85ae9d2220}{00007}} \textcolor{keyword}{auto} \mbox{\hyperlink{struct_ref_a9110bf9f5cb789920e4e9c85ae9d2220}{operator-\/>}}() -\/> \textcolor{keyword}{auto} \{} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00008}00008 \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_af9d6c610a6e855aa1eba054060166247}{kblib::meta\_type\_t}}\{\};} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00009}00009 \} \textcolor{comment}{// present only if sizeof...(Args) == 1}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00010}00010 \};} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00011}00011 } \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00012}00012 \textcolor{comment}{// static decltype(\&Ref::operator-\/>) f;}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00013}00013 \textcolor{comment}{// static decltype(\&Ref::operator-\/>) f2;}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00014}00014 } \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00015}00015 \textcolor{keyword}{static} \mbox{\hyperlink{struct_ref}{Ref}} r;} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00016}00016 \mbox{\hyperlink{tdecl_8h_a607cffc585fe3bfcb06b63be2948de4a}{KBLIB\_UNUSED}} \textcolor{keyword}{static} \mbox{\hyperlink{struct_ref}{Ref}} r2;} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00017}00017 } \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00018}00018 \mbox{\hyperlink{tdecl_8h_a607cffc585fe3bfcb06b63be2948de4a}{KBLIB\_UNUSED}} \textcolor{keyword}{static} \textcolor{keyword}{auto} blah() -\/> \textcolor{keywordtype}{void} \{} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00019}00019 r.operator-\/>();} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00020}00020 \textcolor{comment}{// r2.operator-\/>();}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00021}00021 std::tuple \mbox{\hyperlink{namespacekblib_a22831dce77d5f35c13930b5e30a59f07}{a}}\{0, 0\}, b\{0, 1\};} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00022}00022 \mbox{\hyperlink{namespacekblib_a4aadfdece3872e99551aa812ac3bac27}{kblib::swap}}(\mbox{\hyperlink{namespacekblib_a22831dce77d5f35c13930b5e30a59f07}{a}}, b);} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00023}00023 \}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00024}00024 } \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00025}\mbox{\hyperlink{fakestd_8cpp_a6ba173d5dd912390c97f16d7c9a56fb3}{00025}} \mbox{\hyperlink{fakestd_8cpp_a6ba173d5dd912390c97f16d7c9a56fb3}{TEST\_CASE}}(\textcolor{stringliteral}{"{}to\_unique(lambda)"{}}) \{} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00026}00026 \textcolor{comment}{// to\_unique can make unique\_ptrs to anonymous types}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00027}00027 \textcolor{keyword}{auto} p = \mbox{\hyperlink{namespacekblib_ae8b1b4dad48864760dd5c1ba368c06c9}{kblib::to\_unique}}(\textcolor{keyword}{new} \textcolor{keyword}{auto}([] \{\}), [](\textcolor{keyword}{auto} p) \{ \textcolor{keyword}{delete} p; \});} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00028}00028 \}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00029}00029 } \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00030}\mbox{\hyperlink{fakestd_8cpp_a18a9abd2e7d2b7af3e8540a9fe69964b}{00030}} \mbox{\hyperlink{fakestd_8cpp_a6ba173d5dd912390c97f16d7c9a56fb3}{TEST\_CASE}}(\textcolor{stringliteral}{"{}signed\_cast"{}}) \{} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00031}00031 REQUIRE(kblib::signed\_cast(-\/1ll) == -\/1ull);} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00032}00032 REQUIRE(kblib::signed\_cast(\textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{short}\textcolor{keyword}{>}(78)) == 78);} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00033}00033 \textcolor{keyword}{static\_assert}(} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00034}00034 std::is\_same(} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00035}00035 std::declval()))>::value,} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00036}00036 \textcolor{stringliteral}{"{}"{}});} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00037}00037 \textcolor{keyword}{static\_assert}(std::is\_same<\textcolor{keywordtype}{unsigned} short,} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00038}00038 \textcolor{keyword}{decltype}(kblib::signed\_cast(} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00039}00039 std::declval()))>::value,} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00040}00040 \textcolor{stringliteral}{"{}"{}});} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00041}00041 \textcolor{keyword}{static\_assert}(std::is\_same(} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00042}00042 std::declval()))>::value,} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00043}00043 \textcolor{stringliteral}{"{}"{}});} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00044}00044 \textcolor{keyword}{static\_assert}(std::is\_same<\textcolor{keywordtype}{unsigned} short,} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00045}00045 \textcolor{keyword}{decltype}(kblib::signed\_cast(} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00046}00046 std::declval()))>::value,} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00047}00047 \textcolor{stringliteral}{"{}"{}});} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00048}00048 \textcolor{keyword}{static\_assert}(} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00049}00049 std::is\_same(} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00050}00050 std::declval()))>::value,} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00051}00051 \textcolor{stringliteral}{"{}"{}});} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00052}00052 \textcolor{comment}{// auto \_1 = kblib::signed\_cast(0.0);}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00053}00053 \textcolor{comment}{// auto \_2 = kblib::signed\_cast(0);}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00054}00054 \}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00055}00055 } \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00056}00056 \textcolor{preprocessor}{\#if KBLIB\_USE\_CXX17}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00057}00057 \textcolor{keyword}{template} <\textcolor{keyword}{class} T>} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00058}\mbox{\hyperlink{fakestd_8cpp_ac4377ed06126bd5d73e1906afb4ba8ad}{00058}} \mbox{\hyperlink{tdecl_8h_a607cffc585fe3bfcb06b63be2948de4a}{KBLIB\_UNUSED}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{fakestd_8cpp_ac4377ed06126bd5d73e1906afb4ba8ad}{type\_name\_f}}() -\/> std::string\_view \{} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00059}00059 \textcolor{keyword}{using namespace }\mbox{\hyperlink{namespacestd}{std}};} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00060}00060 \textcolor{preprocessor}{\# ifdef \_\_clang\_\_}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00061}00061 string\_view p = \_\_PRETTY\_FUNCTION\_\_;} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00062}00062 \textcolor{keywordflow}{return} string\_view(p.data() + 36, p.size() -\/ 36 -\/ 1);} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00063}00063 \textcolor{preprocessor}{\# elif defined(\_\_GNUC\_\_)}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00064}00064 string\_view p = \_\_PRETTY\_FUNCTION\_\_;} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00065}00065 \textcolor{preprocessor}{\# if \_\_cplusplus < 201402}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00066}00066 \textcolor{keywordflow}{return} string\_view(p.data() + 36, p.size() -\/ 36 -\/ 1);} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00067}00067 \textcolor{preprocessor}{\# else}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00068}00068 \textcolor{keywordflow}{return} string\_view(p.data() + 49, p.find(\textcolor{charliteral}{';'}, 49) -\/ 49);} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00069}00069 \textcolor{preprocessor}{\# endif}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00070}00070 \textcolor{preprocessor}{\# elif defined(\_MSC\_VER)}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00071}00071 string\_view p = \_\_FUNCSIG\_\_;} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00072}00072 \textcolor{keywordflow}{return} string\_view(p.data() + 84, p.size() -\/ 84 -\/ 7);} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00073}00073 \textcolor{preprocessor}{\# endif}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00074}00074 \}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00075}00075 \textcolor{preprocessor}{\#endif}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00076}00076 } \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00077}00077 \textcolor{preprocessor}{\#if KBLIB\_USE\_CXX17}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00078}\mbox{\hyperlink{fakestd_8cpp_a8ce67cdbddd9047182cb0ea00226e444}{00078}} \mbox{\hyperlink{fakestd_8cpp_a6ba173d5dd912390c97f16d7c9a56fb3}{TEST\_CASE}}(\textcolor{stringliteral}{"{}next\_larger"{}}) \{} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00079}00079 \textcolor{keyword}{static\_assert}(} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00080}00080 std::is\_same::type,} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00081}00081 \textcolor{keywordtype}{short}>::value,} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00082}00082 \textcolor{stringliteral}{"{}signed char < short"{}});} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00083}00083 \textcolor{keyword}{static\_assert}(} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00084}00084 std::is\_same::type, \textcolor{keywordtype}{int}>::value,} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00085}00085 \textcolor{stringliteral}{"{}short < int"{}});} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00086}00086 \textcolor{keyword}{static\_assert}(} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00087}00087 std::is\_same::type, \textcolor{keywordtype}{long}>::value,} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00088}00088 \textcolor{stringliteral}{"{}int < long"{}});} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00089}00089 \textcolor{preprocessor}{\# if 0}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00090}00090 std::cout} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00091}00091 << \textcolor{stringliteral}{"{}Next\_larger: \(\backslash\)n"{}}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00092}00092 << \textcolor{stringliteral}{"{}signed char: "{}}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00093}00093 << type\_name\_f::type>()} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00094}00094 << \textcolor{charliteral}{'\(\backslash\)n'}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00095}00095 << \textcolor{stringliteral}{"{}short: "{}}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00096}00096 << \mbox{\hyperlink{fakestd_8cpp_ac4377ed06126bd5d73e1906afb4ba8ad}{type\_name\_f}}<\mbox{\hyperlink{structkblib_1_1detail_1_1next__larger__signed_aeca02a2e87733928ddb3194131408270}{kblib::detail::next\_larger\_signed::type}}>() << \textcolor{charliteral}{'\(\backslash\)n'}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00097}00097 << \textcolor{stringliteral}{"{}int: "{}}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00098}00098 << type\_name\_f::type>() << \textcolor{charliteral}{'\(\backslash\)n'};} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00099}00099 \textcolor{comment}{// long long can't be promoted}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00100}00100 \textcolor{comment}{// std::cout}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00101}00101 \textcolor{comment}{// << "{}long long: "{}}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00102}00102 \textcolor{comment}{// << type\_name\_f::type>()}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00103}00103 \textcolor{comment}{// << '\(\backslash\)n';}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00104}00104 \textcolor{preprocessor}{\# endif}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00105}00105 \}} \DoxyCodeLine{\Hypertarget{fakestd_8cpp_source_l00106}00106 \textcolor{preprocessor}{\#endif}} \end{DoxyCode}