mirror of
https://github.com/boostorg/mpl.git
synced 2025-08-03 14:54:30 +02:00
add 'is_placeholder'
[SVN r16451]
This commit is contained in:
64
include/boost/mpl/is_placeholder.hpp
Normal file
64
include/boost/mpl/is_placeholder.hpp
Normal file
@@ -0,0 +1,64 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// boost mpl/is_placeholder.hpp header file
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2001-02
|
||||
// Aleksey Gurtovoy
|
||||
//
|
||||
// Permission to use, copy, modify, distribute and sell this software
|
||||
// and its documentation for any purpose is hereby granted without fee,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both the copyright notice and this permission notice appear in
|
||||
// supporting documentation. No representations are made about the
|
||||
// suitability of this software for any purpose. It is provided "as is"
|
||||
// without express or implied warranty.
|
||||
|
||||
#ifndef BOOST_MPL_IS_PLACEHOLDER_HPP_INCLUDED
|
||||
#define BOOST_MPL_IS_PLACEHOLDER_HPP_INCLUDED
|
||||
|
||||
#include "boost/mpl/arg_fwd.hpp"
|
||||
#include "boost/mpl/bool_c.hpp"
|
||||
#include "boost/mpl/aux_/yes_no.hpp"
|
||||
#include "boost/mpl/aux_/config/ctps.hpp"
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
|
||||
template< typename T >
|
||||
struct is_placeholder
|
||||
: bool_c<false>
|
||||
{
|
||||
};
|
||||
|
||||
template< int N >
|
||||
struct is_placeholder< arg<N> >
|
||||
: bool_c<true>
|
||||
{
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
namespace aux {
|
||||
|
||||
aux::no_tag is_placeholder_helper(...);
|
||||
|
||||
template< int N >
|
||||
aux::yes_tag is_placeholder_helper(arg<N>*);
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template< typename T >
|
||||
struct is_placeholder
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
sizeof(aux::is_placeholder_helper(static_cast<T*>(0))) == sizeof(aux::yes_tag)
|
||||
);
|
||||
};
|
||||
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
}} // namespace boost::mpl
|
||||
|
||||
#endif // BOOST_MPL_IS_PLACEHOLDER_HPP_INCLUDED
|
Reference in New Issue
Block a user