4 #define BOOST_TEST_DYN_LINK
5 #define BOOST_TEST_MODULE VirtualFunctionTemplateTest
6 #include <boost/test/unit_test.hpp>
7 using namespace boost::unit_test_framework;
25 std::string getValue_impl(T& ) {
26 return std::string(
"Base: ") +
typeid(T).name();
37 std::string getValue_impl(T& base) {
38 if constexpr(std::is_same_v<std::string, T>) {
41 return std::string(
"Derived1: ") +
typeid(T).name();
52 std::string getValue_impl(T& base) {
53 if constexpr(std::is_same_v<float, T>) {
56 else if constexpr(std::is_same_v<double, T>) {
59 return std::string(
"Derived2: ") +
typeid(T).name();
70 typedef typename std::remove_reference<decltype(pair)>::type::first_type T;
72 BOOST_TEST(base.
getValue<T>(argument) == std::string(
"Base: ") +
typeid(T).name());
81 typedef typename std::remove_reference<decltype(pair)>::type::first_type T;
83 if constexpr(std::is_same_v<T, std::string>) {
84 BOOST_TEST(base.
getValue<T>(argument) == std::string(
"Base: ") +
typeid(T).name());
87 BOOST_TEST(base.
getValue<T>(argument) == std::string(
"Derived1: ") +
typeid(T).name());
97 typedef typename std::remove_reference<decltype(pair)>::type::first_type T;
99 if constexpr(std::is_same_v<T, double>) {
100 BOOST_TEST(base.
getValue<T>(argument) == std::string(
"Base: ") +
typeid(T).name());
102 else if constexpr(std::is_same_v<T, float>) {
103 BOOST_TEST(base.
getValue<T>(argument) == std::string(
"Derived1: ") +
typeid(T).name());
106 BOOST_TEST(base.
getValue<T>(argument) == std::string(
"Derived2: ") +
typeid(T).name());