bsnes/higan/nall/traits.hpp
Tim Allen 94b2538af5 Update to higan v091 release.
byuu says:

Basically just a project rename, with s/bsnes/higan and the new icon
from lowkee added in.

It won't compile on Windows because I forgot to update the resource.rc
file, and a path transform command isn't working on Windows.
It was really just meant as a starting point, so that v091 WIPs can flow
starting from .00 with the new name (it overshadows bsnes v091, so
publicly speaking this "shouldn't exist" and will probably be deleted
from Google Code when v092 is ready.)
2012-12-26 17:46:36 +11:00

34 lines
1.1 KiB
C++
Executable File

#ifndef NALL_TRAITS_HPP
#define NALL_TRAITS_HPP
#include <type_traits>
namespace nall {
template<typename T> class has_default_constructor {
template<signed> class receive_size{};
template<typename U> static signed sfinae(receive_size<sizeof U()>*);
template<typename U> static char sfinae(...);
public:
enum : bool { value = sizeof(sfinae<T>(0)) == sizeof(signed) };
};
template<bool C, typename T = bool> struct enable_if { typedef T type; };
template<typename T> struct enable_if<false, T> {};
template<bool C, typename T, typename F> struct type_if { typedef T type; };
template<typename T, typename F> struct type_if<false, T, F> { typedef F type; };
template<bool A, bool B> struct static_and { enum { value = false }; };
template<> struct static_and<true, true> { enum { value = true }; };
template<bool A, bool B> struct static_or { enum { value = false }; };
template<> struct static_or<false, true> { enum { value = true }; };
template<> struct static_or<true, false> { enum { value = true }; };
template<> struct static_or<true, true> { enum { value = true }; };
}
#endif