標準庫標頭檔案 <ciso646> (C++20 前), <iso646.h>
來自 cppreference.com
此標頭檔案最初是 C 標準庫中的 <iso646.h>。
相容性標頭檔案,在 C 中定義了 替代運算子表示,這些表示在 C++ 中是關鍵字。
這意味著在符合標準的實現中,包含此標頭檔案沒有效果。
[編輯] 注意
在舊的或不符合標準的編譯器中,使用替代運算子表示可能仍需要包含此標頭檔案。
<ciso646>
在 C++20 中已移除。相應的 <iso646.h>
在 C++20 中仍然可用。
在 C++20 之前,包含 <ciso646>
有時被用作一種獲取實現特定庫版本宏定義而不引起其他效果的技術。從 C++20 開始,為此目的添加了標頭檔案 <version>。
執行此程式碼
#include <ciso646> #ifdef _LIBCPP_VERSION #error Using LLVM libc++ #elif __GLIBCXX__ // Note: only version 6.1 or newer define this in ciso646 #error Using GNU libstdc++ #elif _CPPLIB_VER // Note: used by Visual Studio #error Using Microsoft STL #else #error Using an unknown standard library #endif
可能的輸出
main.cpp:7:2: error: Using Microsoft STL #error Using Microsoft STL ^ 1 error generated.