Skip to content

Instantly share code, notes, and snippets.

@MattPD
MattPD / main.cpp
Last active September 22, 2016 09:34
Boost.Hana: compile-time if demo
// Boost.Hana solution
// issue: http://baptiste-wicht.com/posts/2015/07/simulate-static_if-with-c11c14.html
// docs w/ explanation: http://ldionne.com/hana/#tutorial-introspection-is_valid
#include <iostream>
#include <string>
#include <boost/hana.hpp>
auto has_pop_back = boost::hana::is_valid([](auto && obj) -> decltype(obj.pop_back()) { });
#include <iostream>
using std::cout;
int main()
{
cout << "Hello! \n";
return 0;
}