2 * Copyright Andrey Semashev 2007 - 2015.
3 * Distributed under the Boost Software License, Version 1.0.
4 * (See accompanying file LICENSE_1_0.txt or copy at
5 * http://www.boost.org/LICENSE_1_0.txt)
8 * \file unique_identifier_name.hpp
9 * \author Andrey Semashev
12 * The header contains \c BOOST_LOG_UNIQUE_IDENTIFIER_NAME macro definition.
15 #ifndef BOOST_LOG_UTILITY_UNIQUE_IDENTIFIER_NAME_HPP_INCLUDED_
16 #define BOOST_LOG_UTILITY_UNIQUE_IDENTIFIER_NAME_HPP_INCLUDED_
18 #include <boost/preprocessor/cat.hpp>
19 #include <boost/log/detail/config.hpp>
21 #ifdef BOOST_HAS_PRAGMA_ONCE
25 #ifndef BOOST_LOG_DOXYGEN_PASS
27 #define BOOST_LOG_UNIQUE_IDENTIFIER_NAME_INTERNAL_(prefix, postfix)\
28 BOOST_PP_CAT(prefix, postfix)
29 #define BOOST_LOG_UNIQUE_IDENTIFIER_NAME_INTERNAL(prefix, postfix)\
30 BOOST_LOG_UNIQUE_IDENTIFIER_NAME_INTERNAL_(prefix, postfix)
32 #endif // BOOST_LOG_DOXYGEN_PASS
35 * \def BOOST_LOG_UNIQUE_IDENTIFIER_NAME(prefix)
37 * Constructs a unique (in the current file scope) token that can be used as a variable name.
38 * The name will contain a prefix passed in the \a prefix argument. This allows to use the
39 * macro multiple times on a single line.
42 // In VC 7.0 and later when compiling with /ZI option __LINE__ macro is corrupted
44 # define BOOST_LOG_UNIQUE_IDENTIFIER_NAME(prefix)\
45 BOOST_LOG_UNIQUE_IDENTIFIER_NAME_INTERNAL(prefix, __COUNTER__)
47 # define BOOST_LOG_UNIQUE_IDENTIFIER_NAME(prefix)\
48 BOOST_LOG_UNIQUE_IDENTIFIER_NAME_INTERNAL(prefix, __LINE__)
51 #endif // BOOST_LOG_UTILITY_UNIQUE_IDENTIFIER_NAME_HPP_INCLUDED_