Created
December 8, 2015 19:40
-
-
Save ricejasonf/44bc8632b13c2e03d4c4 to your computer and use it in GitHub Desktop.
Class Template Member Class Template Definition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<boost/hana.hpp> | |
#include<iostream> | |
namespace hana = boost::hana; | |
template<typename T> | |
class A | |
{ | |
static constexpr const char* t = hana::to<const char*>(T{}); | |
template<typename> | |
class B; | |
public: | |
template<typename U> | |
void print() | |
{ | |
B<U>().print(); | |
} | |
}; | |
template<typename T> | |
template<typename U> | |
class A<T>::B | |
{ | |
static constexpr const char* u = hana::to<const char*>(U{}); | |
public: | |
void print() | |
{ | |
std::cout << t << " " << u; | |
std::cout << "\n"; | |
} | |
}; | |
int main() | |
{ | |
constexpr auto hello = hana::string_c<'h', 'e', 'l', 'l', 'o'>; | |
constexpr auto world = hana::string_c<'w', 'o', 'r', 'l', 'd'>; | |
A<decltype(hello)>().print<decltype(world)>(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I guess I could have done
.print(world)