From 9a16aaa2b9ebef80131a6ae5f342320393933cd6 Mon Sep 17 00:00:00 2001 From: Lorenzo Caminiti Date: Wed, 15 Feb 2012 00:41:33 +0000 Subject: [PATCH] Added LocalFunction and Utility/IdentityType source files. [SVN r77024] --- include/boost/utility/identity_type.hpp | 45 +++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 include/boost/utility/identity_type.hpp diff --git a/include/boost/utility/identity_type.hpp b/include/boost/utility/identity_type.hpp new file mode 100644 index 0000000..c297c49 --- /dev/null +++ b/include/boost/utility/identity_type.hpp @@ -0,0 +1,45 @@ + +// Copyright (C) 2009-2012 Lorenzo Caminiti +// Distributed under the Boost Software License, Version 1.0 +// (see accompanying file LICENSE_1_0.txt or a copy at +// http://www.boost.org/LICENSE_1_0.txt) +// Home at http://www.boost.org/libs/utility/identity_type + +/** @file +Wrap type expressions with round parenthesis so they can be passed to macros +even if they contain commas. +*/ + +#ifndef BOOST_IDENTITY_TYPE_HPP_ +#define BOOST_IDENTITY_TYPE_HPP_ + +#include + +/** +@brief This macro allows to wrap the specified type expression within extra +round parenthesis so the type can be passed as a single macro parameter even if +it contains commas (not already wrapped within round parenthesis). + +@Params +@Param{parenthesized_type, +The type expression to be passed as macro parameter wrapped by a single set +of round parenthesis (...). +This type expression can contain an arbitrary number of commas. +} +@EndParams + +This macro works on any C++03 compiler (it does not require variadic macros). + +This macro must be prefixed by typename when used within templates. +However, the compiler will not be able to automatically determine function template parameters when they are wrapped with this macro (these parameters need to +be explicitly specified when calling the function template). + +On some compilers (like GCC), using this macro on an abstract types requires to +add and remove a reference to the type. +*/ +#define BOOST_IDENTITY_TYPE(parenthesized_type) \ + /* must NOT prefix this with `::` to work with parenthesized syntax */ \ + boost::function_traits< void parenthesized_type >::arg1_type + +#endif // #include guard +