13 #include <gtest/gtest.h> 14 #include "../../include/ecl/mpl/enable_if.hpp" 15 #include "../../include/ecl/mpl/bool.hpp" 42 class is_float<float> :
public ecl::True {};
45 class is_float<double> :
public ecl::True {};
50 template <
typename T,
typename Enable =
void>
53 bool isSpecialisation() {
return false; }
59 class TestDude< T, typename enable_if< is_float<T> >::type > {
61 bool isSpecialisation() {
return true; }
72 using namespace ecl::mpl::tests;
78 TEST(EnableIfTests,oneshot) {
79 TestDude<float> float_dude;
80 TestDude<int> int_dude;
82 result = float_dude.isSpecialisation();
83 EXPECT_EQ(
true, result);
84 result = int_dude.isSpecialisation();
85 EXPECT_EQ(
false, result);
92 int main(
int argc,
char **argv) {
94 testing::InitGoogleTest(&argc,argv);
95 return RUN_ALL_TESTS();
Embedded control libraries.
Enables the SFINAE concept.
Integral constant wrapper for boolean values.