今天我遇到了这段代码(在 boost/type_index/type_index_facade.hpp中,第252-259行).
/// noexcept comparison operators for type_index_facade classes.
bool operator ==, !=, <, ... (const type_index_facade& lhs, const type_index_facade& rhs) noexcept;
/// noexcept comparison operators for type_index_facade and it's TypeInfo classes.
bool operator ==, !=, <, ... (const type_index_facade& lhs, const TypeInfo& rhs) noexcept;
/// noexcept comparison operators for type_index_facade's TypeInfo and type_index_facade classes.
bool operator ==, !=, <, ... (const TypeInfo& lhs, const type_index_facade& rhs) noexcept;
Run Code Online (Sandbox Code Playgroud)
有人能解释一下这是什么意思吗?我以前从未见过像"==,!=,<,......"之类的东西.
md5*_*d5i 32
你会注意到这些是写在:
#if defined(BOOST_TYPE_INDEX_DOXYGEN_INVOKED)
...
#endif
Run Code Online (Sandbox Code Playgroud)
这只是一个让doxygen在文档中使用这些"简化"声明的黑客攻击.从未编译过这段代码.