这条线是做什么的? 我怀疑它是一个模板或表达式。 (做那些事并命名一个成员 hpp 是个坏主意)
# define BOOST_PP_UPDATE_COUNTER() <boost/preprocessor/slot/detail/counter.hpp>
完整文件
# /* **************************************************************************
# * *
# * (C) Copyright Paul Mensonides 2005. *
# * 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) *
# * *
# ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_SLOT_COUNTER_HPP
# define BOOST_PREPROCESSOR_SLOT_COUNTER_HPP
#
# include <boost/preprocessor/slot/detail/def.hpp>
#
# /* BOOST_PP_COUNTER */
#
# define BOOST_PP_COUNTER 0
#
# /* BOOST_PP_UPDATE_COUNTER */
#
# define BOOST_PP_UPDATE_COUNTER() <boost/preprocessor/slot/detail/counter.hpp>
#
# endif
最佳答案
Apparently it does some auto-incrementing magic.
这是 the documentation .
我不知道它是如何工作的。我所知道的是,魔法就在 counter.hpp 本身;你发布的定义中有括号只是为了让你可以写出模糊的用户友好:
#include BOOST_PP_UPDATE_COUNTER()
调用所述魔法。
关于c++ - #define macro() <...> 做什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6212476/