Create a gist now

Instantly share code, notes, and snippets.

オーバーロードに優先順位をつけるためのライブラリ。SFINAE のおともに。 C++ Overload Priority Library
// Copyright (C) 2011 RiSK (sscrisk)
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#if !defined(SSCRISK_OVERLOAD_PRIORITY_HPP)
#define SSCRISK_OVERLOAD_PRIORITY_HPP
#if defined(_MSC_VER) && _MSC_VER >= 1020
#pragma once
#endif
// overload_priority_hpp
namespace sscrisk{ namespace overload_priority{ namespace detail{
template<unsigned Priority>
struct overload_priority
: overload_priority<Priority - 1>
{};
template<>
struct overload_priority<0>
{};
}
typedef detail::overload_priority<6> const * highest;
typedef detail::overload_priority<5> const * higher;
typedef detail::overload_priority<4> const * high;
typedef detail::overload_priority<3> const * normal;
typedef detail::overload_priority<2> const * low;
typedef detail::overload_priority<1> const * lower;
typedef detail::overload_priority<0> const * lowest;
// ... is the lowest.
}
overload_priority::highest const use_overload_priority = nullptr;
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment