Program Listing for File TemplateUtils.hpp

Return to documentation for file (include/networkit/auxiliary/TemplateUtils.hpp)

#ifndef NETWORKIT_AUXILIARY_TEMPLATE_UTILS_HPP_
#define NETWORKIT_AUXILIARY_TEMPLATE_UTILS_HPP_

#include <type_traits>

#define AUX_REQUIRE(what, ...) class what = typename ::std::enable_if<__VA_ARGS__>::type

#define AUX_DUMMY_ARGUMENT class = void

namespace Aux {

template <typename T>
using decay_t = typename std::decay<T>::type;

template <bool B>
using boolToType = std::integral_constant<bool, B>;

template <typename T1, typename T2>
constexpr bool isSame() {
    return std::is_same<T1, T2>::value;
}

template <typename Base, typename Derived>
constexpr bool isBaseOrSame() {
    return isSame<Base, Derived>() || std::is_base_of<Base, Derived>::value;
}

} // namespace Aux

#endif // NETWORKIT_AUXILIARY_TEMPLATE_UTILS_HPP_