\hypertarget{poly__obj_8cpp_source}{}\doxysection{poly\+\_\+obj.\+cpp} \label{poly__obj_8cpp_source}\index{tests/poly\_obj.cpp@{tests/poly\_obj.cpp}} \mbox{\hyperlink{poly__obj_8cpp}{Go to the documentation of this file.}} \begin{DoxyCode}{0} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00001}00001 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{poly__obj_8h}{kblib/poly\_obj.h}}"{}}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00002}00002 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00003}00003 \textcolor{preprocessor}{\#include "{}catch.hpp"{}}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00004}00004 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00005}00005 \textcolor{preprocessor}{\#if KBLIB\_USE\_CXX17}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00006}00006 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00007}00007 \textcolor{keyword}{namespace }\{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00008}00008 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00009}00009 \textcolor{keyword}{enum} barks \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00010}00010 vgood\_base,} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00011}00011 dgood\_base,} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00012}00012 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00013}00013 vgood\_derived,} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00014}00014 dgood\_derived,} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00015}00015 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00016}00016 vbad\_base1,} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00017}00017 dbad\_base1,} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00018}00018 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00019}00019 vbad\_derived1,} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00020}00020 dbad\_derived1,} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00021}00021 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00022}00022 vbad\_base2,} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00023}00023 dbad\_base2,} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00024}00024 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00025}00025 vbad\_derived2,} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00026}00026 dbad\_derived2,} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00027}00027 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00028}00028 vsmall\_base,} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00029}00029 dsmall\_base,} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00030}00030 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00031}00031 vbig\_derived,} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00032}00032 dbig\_derived,} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00033}00033 \};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00034}00034 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00035}00035 std::vector bark\_log;} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00036}00036 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00037}00037 \textcolor{keyword}{struct }good\_base \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00038}00038 good\_base() = \textcolor{keywordflow}{default};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00039}00039 \textcolor{keyword}{virtual} \string~good\_base() noexcept \{ bark\_log.push\_back(dgood\_base); \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00040}00040 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00041}00041 \textcolor{keyword}{virtual} \textcolor{keyword}{auto} bark() const -\/> \textcolor{keywordtype}{void} \{ bark\_log.push\_back(vgood\_base); \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00042}00042 \};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00043}00043 \textcolor{keyword}{struct }good\_derived : good\_base \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00044}00044 \string~good\_derived() noexcept\textcolor{keyword}{ override }\{ bark\_log.push\_back(dgood\_derived); \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00045}00045 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00046}00046 \textcolor{keyword}{auto} bark() const -\/> \textcolor{keywordtype}{void}\textcolor{keyword}{ override }\{ bark\_log.push\_back(vgood\_derived); \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00047}00047 \};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00048}00048 \textcolor{keyword}{struct }unrelated \{\};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00049}00049 \textcolor{keyword}{struct }bad\_nocopy : good\_base \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00050}00050 bad\_nocopy(\textcolor{keyword}{const} bad\_nocopy\&) = \textcolor{keyword}{delete};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00051}00051 \};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00052}00052 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00053}00053 \textcolor{keyword}{struct }bad\_base1 \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00054}00054 \textcolor{keyword}{virtual} \textcolor{keyword}{auto} bark() const -\/> \textcolor{keywordtype}{void} \{ bark\_log.push\_back(vbad\_base1); \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00055}00055 \textcolor{comment}{// non-\/virtual destructor}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00056}00056 \string~bad\_base1() noexcept \{ bark\_log.push\_back(dbad\_base1); \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00057}00057 \};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00058}00058 \textcolor{keyword}{struct }bad\_derived1 : bad\_base1 \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00059}00059 \textcolor{keyword}{auto} bark() const -\/> \textcolor{keywordtype}{void}\textcolor{keyword}{ override }\{ bark\_log.push\_back(vbad\_derived1); \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00060}00060 \mbox{\hyperlink{tdecl_8h_a607cffc585fe3bfcb06b63be2948de4a}{KBLIB\_UNUSED}} \string~bad\_derived1() noexcept \{ bark\_log.push\_back(dbad\_derived1); \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00061}00061 \};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00062}00062 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00063}00063 \textcolor{keyword}{struct }bad\_base2 \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00064}00064 bad\_base2() = \textcolor{keywordflow}{default};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00065}00065 \textcolor{keyword}{virtual} \string~bad\_base2() noexcept \{ bark\_log.push\_back(dbad\_base2); \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00066}00066 \textcolor{keyword}{virtual} \textcolor{keyword}{auto} bark() const -\/> \textcolor{keywordtype}{void} \{ bark\_log.push\_back(vbad\_base2); \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00067}00067 \};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00068}00068 \textcolor{keyword}{struct }bad\_derived2 : \textcolor{keyword}{protected} bad\_base2 \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00069}00069 \textcolor{keyword}{auto} bark() const -\/> \textcolor{keywordtype}{void}\textcolor{keyword}{ override }\{ bark\_log.push\_back(vbad\_derived2); \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00070}00070 \string~bad\_derived2() noexcept\textcolor{keyword}{ override }\{ bark\_log.push\_back(dbad\_derived2); \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00071}00071 \};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00072}00072 \textcolor{keyword}{struct }small\_base \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00073}00073 small\_base() = \textcolor{keywordflow}{default};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00074}00074 \textcolor{keyword}{virtual} \string~small\_base() noexcept = default;} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00075}00075 virtual auto bark() const -\/> \textcolor{keywordtype}{void} \{ bark\_log.push\_back(vsmall\_base); \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00076}00076 \textcolor{keyword}{virtual} \textcolor{keyword}{auto} id() const -\/> \textcolor{keywordtype}{int} \{ \textcolor{keywordflow}{return} 0; \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00077}00077 \};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00078}00078 \textcolor{keyword}{struct }big\_derived : small\_base \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00079}00079 std::size\_t x} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00080}00080 = (\textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{void}\textcolor{keyword}{>}(x = 1),} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00081}00081 kblib::FNVa\_a(} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00082}00082 \textcolor{keyword}{reinterpret\_cast<}\textcolor{keyword}{const }\textcolor{keywordtype}{char} (\&)[sizeof(big\_derived)]\textcolor{keyword}{>}(*\textcolor{keyword}{this})));} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00083}00083 \textcolor{keyword}{auto} bark() const -\/> \textcolor{keywordtype}{void}\textcolor{keyword}{ override }\{ bark\_log.push\_back(vbig\_derived); \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00084}00084 \string~big\_derived() noexcept override = default;} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00085}00085 auto \textcolor{keywordtype}{id}() const -\/> \textcolor{keywordtype}{int}\textcolor{keyword}{ override }\{ \textcolor{keywordflow}{return} 1; \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00086}00086 \};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00087}00087 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00088}00088 \textcolor{keyword}{struct }not\_copyable \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00089}00089 not\_copyable() = \textcolor{keywordflow}{default};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00090}00090 not\_copyable(\textcolor{keyword}{const} not\_copyable\&) = \textcolor{keyword}{delete};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00091}00091 \mbox{\hyperlink{tdecl_8h_a607cffc585fe3bfcb06b63be2948de4a}{KBLIB\_UNUSED}} not\_copyable(not\_copyable\&\&) noexcept = default;} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00092}00092 virtual \string~not\_copyable() = default;} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00093}00093 \};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00094}00094 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00095}00095 struct copyable\_derived : not\_copyable \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00096}00096 \mbox{\hyperlink{tdecl_8h_a607cffc585fe3bfcb06b63be2948de4a}{KBLIB\_UNUSED}} copyable\_derived() = \textcolor{keywordflow}{default};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00097}00097 copyable\_derived(\textcolor{keyword}{const} copyable\_derived\&) \{\}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00098}00098 copyable\_derived(copyable\_derived\&\&) noexcept = default;} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00099}00099 \};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00100}00100 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00101}00101 struct copyable\_base \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00102}00102 \textcolor{keyword}{virtual} \string~copyable\_base() = \textcolor{keywordflow}{default};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00103}00103 \};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00104}00104 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00105}00105 \textcolor{keyword}{struct }noncopyable\_derived : copyable\_base \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00106}00106 \mbox{\hyperlink{tdecl_8h_a607cffc585fe3bfcb06b63be2948de4a}{KBLIB\_UNUSED}} noncopyable\_derived() = \textcolor{keywordflow}{default};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00107}00107 noncopyable\_derived(\textcolor{keyword}{const} noncopyable\_derived\&) = \textcolor{keyword}{delete};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00108}00108 \mbox{\hyperlink{tdecl_8h_a607cffc585fe3bfcb06b63be2948de4a}{KBLIB\_UNUSED}} noncopyable\_derived(noncopyable\_derived\&\&) = \textcolor{keywordflow}{default};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00109}00109 \};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00110}00110 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00111}00111 \textcolor{keyword}{struct }hinted\_base \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00112}00112 \textcolor{keyword}{constexpr} \textcolor{keyword}{static} std::size\_t max\_derived\_size = \textcolor{keyword}{sizeof}(big\_derived);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00113}00113 \textcolor{keyword}{virtual} \string~hinted\_base() = \textcolor{keywordflow}{default};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00114}00114 \};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00115}00115 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00116}00116 \textcolor{keyword}{struct }hinted\_derived : hinted\_base \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00117}00117 \textcolor{keywordtype}{int} member;} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00118}00118 \};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00119}00119 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00120}00120 \textcolor{keyword}{template} <\textcolor{keyword}{typename} T>} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00121}00121 \textcolor{keyword}{struct }\mbox{\hyperlink{structprint}{print}};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00122}00122 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00123}00123 \} \textcolor{comment}{// namespace}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00124}00124 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00125}\mbox{\hyperlink{poly__obj_8cpp_a4cdbba6c9181e63adcf1eb435e35fcdd}{00125}} \mbox{\hyperlink{poly__obj_8cpp_a4cdbba6c9181e63adcf1eb435e35fcdd}{TEST\_CASE}}(\textcolor{stringliteral}{"{}poly\_obj"{}}) \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00126}00126 SECTION(\textcolor{stringliteral}{"{}basic"{}}) \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00127}00127 std::vector expected;} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00128}00128 bark\_log.clear();} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00129}00129 \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00130}00130 \mbox{\hyperlink{classkblib_1_1poly__obj}{kblib::poly\_obj}} o1, o2\{std::in\_place\};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00131}00131 REQUIRE(not o1.\mbox{\hyperlink{classkblib_1_1poly__obj_ad4a570988c6bc362b4485d7e80adc0c3}{has\_value}}());} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00132}00132 REQUIRE(o2.has\_value());} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00133}00133 o2-\/>bark(); \textcolor{comment}{// good\_base}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00134}00134 expected.push\_back(vgood\_base);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00135}00135 REQUIRE(bark\_log == expected);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00136}00136 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00137}00137 o1 = \mbox{\hyperlink{classkblib_1_1poly__obj}{kblib::poly\_obj::make}}(); \textcolor{comment}{// temporary}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00138}00138 \textcolor{comment}{// destroyed}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00139}00139 expected.push\_back(dgood\_derived);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00140}00140 expected.push\_back(dgood\_base);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00141}00141 REQUIRE(bark\_log == expected);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00142}00142 REQUIRE(o1.\mbox{\hyperlink{classkblib_1_1poly__obj_ad4a570988c6bc362b4485d7e80adc0c3}{has\_value}}());} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00143}00143 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00144}00144 o1-\/>bark(); \textcolor{comment}{// good\_derived}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00145}00145 expected.push\_back(vgood\_derived);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00146}00146 REQUIRE(bark\_log == expected);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00147}00147 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00148}00148 o2 = o1; \textcolor{comment}{// o2 \string~good\_base}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00149}00149 expected.push\_back(dgood\_base);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00150}00150 REQUIRE(bark\_log == expected);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00151}00151 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00152}00152 o2-\/>bark(); \textcolor{comment}{// good\_derived}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00153}00153 expected.push\_back(vgood\_derived);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00154}00154 REQUIRE(bark\_log == expected);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00155}00155 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00156}00156 o1.\mbox{\hyperlink{classkblib_1_1poly__obj_af2a2a9fc9fffe8e76a2cf1ef1cd8fb18}{clear}}(); \textcolor{comment}{//\string~good\_derived, \string~good\_base}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00157}00157 expected.push\_back(dgood\_derived);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00158}00158 expected.push\_back(dgood\_base);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00159}00159 REQUIRE(bark\_log == expected);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00160}00160 REQUIRE(not o1.\mbox{\hyperlink{classkblib_1_1poly__obj_ad4a570988c6bc362b4485d7e80adc0c3}{has\_value}}());} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00161}00161 REQUIRE(o2.has\_value());} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00162}00162 \textcolor{comment}{// kblib::poly\_obj o3 =}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00163}00163 \textcolor{comment}{// kblib::poly\_obj::make();}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00164}00164 \} \textcolor{comment}{// o2: \string~good\_derived, \string~good\_base}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00165}00165 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00166}00166 expected.push\_back(dgood\_derived);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00167}00167 expected.push\_back(dgood\_base);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00168}00168 REQUIRE(bark\_log == expected);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00169}00169 \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00170}00170 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00171}00171 SECTION(\textcolor{stringliteral}{"{}non-\/virtual destructor"{}}) \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00172}00172 \textcolor{comment}{// static\_assertion fails because of non-\/virtual destructor}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00173}00173 \textcolor{comment}{// kblib::poly\_obj o3, o4\{std::in\_place\};}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00174}00174 \textcolor{comment}{// o3 = kblib::poly\_obj::make();}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00175}00175 \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00176}00176 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00177}00177 SECTION(\textcolor{stringliteral}{"{}private base"{}}) \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00178}00178 std::vector expected;} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00179}00179 bark\_log.clear();} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00180}00180 \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00181}00181 \mbox{\hyperlink{classkblib_1_1poly__obj}{kblib::poly\_obj}} o5, o6\{std::in\_place\};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00182}00182 \textcolor{comment}{// illegal -\/ non-\/public base}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00183}00183 \textcolor{comment}{// o5 = kblib::poly\_obj::make();}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00184}00184 \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00185}00185 expected.push\_back(dbad\_base2);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00186}00186 REQUIRE(bark\_log == expected);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00187}00187 \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00188}00188 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00189}00189 SECTION(\textcolor{stringliteral}{"{}capacity"{}}) \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00190}00190 std::vector expected;} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00191}00191 bark\_log.clear();} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00192}00192 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00193}00193 \textcolor{comment}{// illegal -\/ unrelated types}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00194}00194 \textcolor{comment}{// kblib::poly\_obj::make();}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00195}00195 \textcolor{comment}{// illegal -\/ derived too big}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00196}00196 \textcolor{comment}{// kblib::poly\_obj::make();}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00197}00197 \textcolor{comment}{// fine}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00198}00198 \mbox{\hyperlink{classkblib_1_1poly__obj}{kblib::poly\_obj}} o7, o8\{std::in\_place\};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00199}00199 o8-\/>bark();} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00200}00200 expected.push\_back(vsmall\_base);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00201}00201 REQUIRE(bark\_log == expected);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00202}00202 o7 = \mbox{\hyperlink{classkblib_1_1poly__obj}{kblib::poly\_obj}}::make();} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00204}00204 REQUIRE(o7.has\_value());} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00205}00205 o7-\/>bark();} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00206}00206 expected.push\_back(vbig\_derived);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00207}00207 REQUIRE(bark\_log == expected);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00208}00208 \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00209}00209 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00210}00210 SECTION(\textcolor{stringliteral}{"{}non-\/copyable type"{}}) \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00211}00211 \textcolor{comment}{// A poly\_obj of non-\/copyable type is allowed and non-\/copyable}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00212}00212 \mbox{\hyperlink{classkblib_1_1poly__obj}{kblib::poly\_obj}} o1\{std::in\_place\}, o2;} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00213}00213 \textcolor{comment}{// illegal}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00214}00214 \textcolor{comment}{// o2 = o1;}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00215}00215 \textcolor{comment}{// legal}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00216}00216 o2 = std::move(o1);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00217}00217 \textcolor{comment}{// legal}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00218}00218 \textcolor{keyword}{auto} o3 = \mbox{\hyperlink{classkblib_1_1poly__obj}{kblib::poly\_obj::make}}();} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00219}00219 \textcolor{comment}{// illegal (can't copy even if derived is copyable)}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00220}00220 \textcolor{comment}{// o1 = o3;}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00221}00221 \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00222}00222 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00223}00223 SECTION(\textcolor{stringliteral}{"{}non-\/copyable derived"{}}) \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00224}00224 \mbox{\hyperlink{classkblib_1_1poly__obj}{kblib::poly\_obj}}}}>} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00226}00226 o1\{std::in\_place\};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00227}00227 \textcolor{comment}{// Valid because the template parameters explicitly disable copying, so}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00228}00228 \textcolor{comment}{// derived classes don't need to be copyable.}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00229}00229 \textcolor{keyword}{auto} o2 = \textcolor{keyword}{decltype}(o1)::make();} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00230}00230 \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00231}00231 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00232}00232 SECTION(\textcolor{stringliteral}{"{}mixed vector"{}}) \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00233}00233 \textcolor{keyword}{auto} r = [n = std::uint16\_t\{16127\}]() \textcolor{keyword}{mutable} \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00234}00234 n \string^= 19937u;} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00235}00235 n *= 4889;} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00236}00236 \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_a8d67d64eac176d35844a629ff0aeacdf}{kblib::FNV32a}}(\{\textcolor{keyword}{reinterpret\_cast<}\textcolor{keywordtype}{char}*\textcolor{keyword}{>}(\&n), \textcolor{keyword}{sizeof}(n)\});} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00237}00237 \};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00238}00238 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00239}00239 \textcolor{keyword}{using }obj = \mbox{\hyperlink{classkblib_1_1poly__obj}{kblib::poly\_obj}};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00240}00240 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00241}00241 std::vector polyvec;} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00242}00242 \textcolor{keywordtype}{int} g[2] = \{\};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00243}00243 \mbox{\hyperlink{namespacekblib_a44de39f5ab34ae1bf5b037eb11155caa}{std::generate\_n}}(std::back\_inserter(polyvec), 128, [\&] \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00244}00244 \textcolor{keywordflow}{if} ((r() \% 2)) \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00245}00245 ++g[1];} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00246}00246 \textcolor{keywordflow}{return} obj::make();} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00247}00247 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00248}00248 ++g[0];} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00249}00249 \textcolor{keywordflow}{return} obj(std::in\_place);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00250}00250 \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00251}00251 \});} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00252}00252 REQUIRE(g[0] == 64);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00253}00253 REQUIRE(g[1] == 64);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00254}00254 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00255}00255 \textcolor{keywordtype}{int} c[2] = \{\};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00256}00256 \textcolor{comment}{// char ab[] = "{}ab"{};}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00257}00257 \textcolor{keywordflow}{for} (\textcolor{keyword}{const} \textcolor{keyword}{auto}\& o : polyvec) \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00258}00258 ++c[o-\/>id()];} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00259}00259 \textcolor{comment}{// std::cout << ab[o-\/>id()];}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00260}00260 \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00261}00261 REQUIRE(c[0] == 64);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00262}00262 REQUIRE(c[1] == 64);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00263}00263 \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00264}00264 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00265}00265 SECTION(\textcolor{stringliteral}{"{}free make function"{}}) \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00266}00266 \textcolor{comment}{// Automatically takes the larger capacity value, but returns a base}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00267}00267 \textcolor{comment}{// pointer}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00268}00268 \textcolor{keyword}{auto} o = kblib::make\_poly\_obj();} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00269}00269 \textcolor{keyword}{static\_assert}(} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00270}00270 std::is\_same\_v<\textcolor{keyword}{decltype}(o),} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00271}00271 \mbox{\hyperlink{classkblib_1_1poly__obj}{kblib::poly\_obj}}>,} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00272}00272 \textcolor{stringliteral}{"{}make\_poly\_obj must return the correct type."{}});} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00273}00273 \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00274}00274 SECTION(\textcolor{stringliteral}{"{}hinted"{}}) \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00275}00275 \textcolor{keyword}{static\_assert}(\mbox{\hyperlink{structkblib_1_1poly__obj__traits}{kblib::poly\_obj\_traits::default\_capacity}}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00276}00276 == hinted\_base::max\_derived\_size);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00277}00277 \mbox{\hyperlink{classkblib_1_1poly__obj}{kblib::poly\_obj}} o;} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00278}00278 \textcolor{keyword}{static\_assert}(\textcolor{keyword}{decltype}(o)::capacity} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00279}00279 == \textcolor{keyword}{decltype}(o)::base\_type::max\_derived\_size);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00280}00280 o = \textcolor{keyword}{decltype}(o)::make();} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00281}00281 \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00282}00282 \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00283}00283 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00284}00284 \textcolor{keyword}{namespace }\{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00285}00285 \textcolor{keyword}{struct }mem\_ptr\_test \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00286}00286 \textcolor{keywordtype}{int} member\{42\};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00287}00287 \textcolor{keyword}{auto} get\_member() \& \textcolor{keyword}{noexcept} -\/> \textcolor{keywordtype}{int} \{ \textcolor{keywordflow}{return} member; \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00288}00288 \textcolor{keyword}{auto} cget\_member() const\& noexcept -\/> \textcolor{keywordtype}{int} \{ \textcolor{keywordflow}{return} member; \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00289}00289 \textcolor{keyword}{auto} rget\_member() \&\& \textcolor{keyword}{noexcept} -\/> \textcolor{keywordtype}{int} \{ \textcolor{keywordflow}{return} member; \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00290}00290 \textcolor{keyword}{auto} crget\_member() const\&\& noexcept -\/> \textcolor{keywordtype}{int} \{ \textcolor{keywordflow}{return} member; \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00291}00291 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00292}00292 \textcolor{keyword}{auto} get\_member2() noexcept -\/> \textcolor{keywordtype}{int} \{ \textcolor{keywordflow}{return} member; \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00293}00293 \textcolor{keyword}{auto} cget\_member2() const noexcept -\/> \textcolor{keywordtype}{int} \{ \textcolor{keywordflow}{return} member; \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00294}00294 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00295}00295 \textcolor{keyword}{virtual} \string~mem\_ptr\_test() = \textcolor{keywordflow}{default};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00296}00296 \};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00297}00297 \} \textcolor{comment}{// namespace}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00298}00298 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00299}\mbox{\hyperlink{poly__obj_8cpp_a8e193b641d59856c5b01b2acb72e036e}{00299}} \mbox{\hyperlink{poly__obj_8cpp_a4cdbba6c9181e63adcf1eb435e35fcdd}{TEST\_CASE}}(\textcolor{stringliteral}{"{}poly\_obj-\/>*"{}}) \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00300}00300 \mbox{\hyperlink{classkblib_1_1poly__obj}{kblib::poly\_obj}} obj\{std::in\_place\};} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00301}00301 SECTION(\textcolor{stringliteral}{"{}member data"{}}) \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00302}00302 \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} data\_member = \&mem\_ptr\_test::member;} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00303}00303 REQUIRE(obj-\/>*data\_member == 42);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00304}00304 \textcolor{keyword}{static\_assert}(std::is\_same\_v<\textcolor{keyword}{decltype}(obj-\/>*data\_member), \textcolor{keywordtype}{int}\&>);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00305}00305 \textcolor{keyword}{static\_assert}(std::is\_same\_v<\textcolor{keyword}{decltype}(std::as\_const(obj)-\/>*data\_member),} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00306}00306 \textcolor{keyword}{const} \textcolor{keywordtype}{int}\&>);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00307}00307 \textcolor{keyword}{static\_assert}(} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00308}00308 std::is\_same\_v<\textcolor{keyword}{decltype}(std::move(obj)-\/>*data\_member), \textcolor{keywordtype}{int}\&\&>);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00309}00309 \textcolor{keyword}{static\_assert}(} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00310}00310 std::is\_same\_v<\textcolor{keyword}{decltype}(std::move(std::as\_const(obj))-\/>*data\_member),} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00311}00311 \textcolor{keyword}{const} \textcolor{keywordtype}{int}\&\&>);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00312}00312 \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00313}00313 SECTION(\textcolor{stringliteral}{"{}member function"{}}) \{} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00314}00314 \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} func\_member = \&mem\_ptr\_test::get\_member;} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00315}00315 \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} cfunc\_member = \&mem\_ptr\_test::cget\_member;} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00316}00316 \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} rfunc\_member = \&mem\_ptr\_test::rget\_member;} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00317}00317 \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} crfunc\_member = \&mem\_ptr\_test::crget\_member;} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00318}00318 REQUIRE((obj-\/>*func\_member)() == 42);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00319}00319 \textcolor{keyword}{static\_assert}(std::is\_same\_v<\textcolor{keyword}{decltype}((obj-\/>*func\_member)()), \textcolor{keywordtype}{int}>);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00320}00320 REQUIRE((obj-\/>*cfunc\_member)() == 42);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00321}00321 \textcolor{keyword}{static\_assert}(std::is\_same\_v<\textcolor{keyword}{decltype}((obj-\/>*cfunc\_member)()), \textcolor{keywordtype}{int}>);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00322}00322 REQUIRE((std::as\_const(obj)-\/>*cfunc\_member)() == 42);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00323}00323 \textcolor{keyword}{static\_assert}(} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00324}00324 std::is\_same\_v<\textcolor{keyword}{decltype}((std::as\_const(obj)-\/>*cfunc\_member)()), \textcolor{keywordtype}{int}>);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00325}00325 REQUIRE((std::move(obj)-\/>*rfunc\_member)() == 42);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00326}00326 \textcolor{keyword}{static\_assert}(} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00327}00327 std::is\_same\_v<\textcolor{keyword}{decltype}((std::move(obj)-\/>*rfunc\_member)()), \textcolor{keywordtype}{int}>);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00328}00328 REQUIRE((std::move(obj)-\/>*crfunc\_member)() == 42);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00329}00329 \textcolor{keyword}{static\_assert}(} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00330}00330 std::is\_same\_v<\textcolor{keyword}{decltype}((std::move(obj)-\/>*crfunc\_member)()), \textcolor{keywordtype}{int}>);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00331}00331 REQUIRE((std::move(std::as\_const(obj))-\/>*crfunc\_member)() == 42);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00332}00332 \textcolor{keyword}{static\_assert}(std::is\_same\_v<} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00333}00333 \textcolor{keyword}{decltype}((std::move(std::as\_const(obj))-\/>*crfunc\_member)()),} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00334}00334 \textcolor{keywordtype}{int}>);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00335}00335 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00336}00336 \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} func\_member2 = \&mem\_ptr\_test::get\_member2;} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00337}00337 \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} cfunc\_member2 = \&mem\_ptr\_test::cget\_member2;} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00338}00338 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00339}00339 REQUIRE((obj-\/>*func\_member2)() == 42);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00340}00340 \textcolor{keyword}{static\_assert}(std::is\_same\_v<\textcolor{keyword}{decltype}((obj-\/>*func\_member2)()), \textcolor{keywordtype}{int}>);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00341}00341 REQUIRE((obj-\/>*cfunc\_member2)() == 42);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00342}00342 \textcolor{keyword}{static\_assert}(std::is\_same\_v<\textcolor{keyword}{decltype}((obj-\/>*cfunc\_member2)()), \textcolor{keywordtype}{int}>);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00343}00343 REQUIRE((std::as\_const(obj)-\/>*cfunc\_member2)() == 42);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00344}00344 \textcolor{keyword}{static\_assert}(} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00345}00345 std::is\_same\_v<\textcolor{keyword}{decltype}((std::as\_const(obj)-\/>*cfunc\_member2)()),} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00346}00346 \textcolor{keywordtype}{int}>);} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00347}00347 \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00348}00348 \}} \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00349}00349 } \DoxyCodeLine{\Hypertarget{poly__obj_8cpp_source_l00350}00350 \textcolor{preprocessor}{\#endif }\textcolor{comment}{// KBLIB\_USE\_CXX17}} \end{DoxyCode}