](/w/cpp/header/tuple "cpp/header/tuple") [ ` <utility> ` ](/w/cpp/header/utility "cpp/header/utility") |  (C++14)  |  [ N3670 ](https://wg21.link/N3670)  
` __cpp_lib_type_identity ` |  std::type_identity  |  201806L  |  [ ` <type_traits> ` ](/w/cpp/header/type_traits "cpp/header/type traits") |  (C++20)  |  [ P0887R1 ](https://wg21.link/P0887R1)  
` __cpp_lib_type_trait_  variable_templates ` |  Type traits variable templates (  [ std::is_void_v ](/w/cpp/types/is_void "cpp/types/is void") , etc)  |  201510L  |  [ ` <type_traits> ` ](/w/cpp/header/type_traits "cpp/header/type traits") |  (C++17)  |  [ P0006R0 ](https://wg21.link/P0006R0)  
` __cpp_lib_uncaught_exceptions ` |  [ ` std::uncaught_exceptions ` ](/w/cpp/error/uncaught_exception "cpp/error/uncaught exception") |  201411L  |  [ ` <exception> ` ](/w/cpp/header/exception "cpp/header/exception") |  (C++17)  |  [ N4259 ](https://wg21.link/N4259)  
` __cpp_lib_unordered_  map_try_emplace ` |  [ std::unordered_map::try_emplace ](/w/cpp/container/unordered_map/try_emplace "cpp/container/unordered map/try emplace") ,  [ std::unordered_map::insert_or_assign ](/w/cpp/container/unordered_map/insert_or_assign "cpp/container/unordered map/insert or assign") |  201411L  |  [ ` <unordered_map> ` ](/w/cpp/header/unordered_map "cpp/header/unordered map") |  (C++17)  |  [ N4279 ](https://wg21.link/N4279)  
` __cpp_lib_unreachable ` |  std::unreachable  |  202202L  |  [ ` <utility> ` ](/w/cpp/header/utility "cpp/header/utility") |  (C++23)  |  [ P0627R6 ](https://wg21.link/P0627R6)  
` __cpp_lib_unwrap_ref ` |  [ std::unwrap_ref_decay ](/w/cpp/utility/functional/unwrap_reference "cpp/utility/functional/unwrap reference") and  [ std::unwrap_reference ](/w/cpp/utility/functional/unwrap_reference "cpp/utility/functional/unwrap reference") |  201811L  |  [ ` <type_traits> ` ](/w/cpp/header/type_traits "cpp/header/type traits") |  (C++20)  |  [ P0318R1 ](https://wg21.link/P0318R1)   
[ LWG3348 ](https://wg21.link/LWG3348)  
` __cpp_lib_variant ` |  [ std::variant ](/w/cpp/utility/variant "cpp/utility/variant") : a type-safe union for C++17  |  201606L  |  [ ` <variant> ` ](/w/cpp/header/variant "cpp/header/variant") |  (C++17)  |  [ P0088R3 ](https://wg21.link/P0088R3)   
[ P0393R3 ](https://wg21.link/P0393R3)  
[ P0032R3 ](https://wg21.link/P0032R3)  
[ std::visit ](/w/cpp/utility/variant/visit "cpp/utility/variant/visit") for classes derived from  [ std::variant ](/w/cpp/utility/variant "cpp/utility/variant") |  202102L  |  [ ` <variant> ` ](/w/cpp/header/variant "cpp/header/variant") |  (C++17)    
(DR)  |  [ P2162R2 ](https://wg21.link/P2162R2)  
Fully ` constexpr ` [ std::variant ](/w/cpp/utility/variant "cpp/utility/variant") |  202106L  |  [ ` <variant> ` ](/w/cpp/header/variant "cpp/header/variant") |  (C++20)    
(DR)  |  [ P2231R1 ](https://wg21.link/P2231R1)  
Member [ ` visit ` ](/w/cpp/utility/variant/visit2 "cpp/utility/variant/visit2") |  202306L  |  [ ` <variant> ` ](/w/cpp/header/variant "cpp/header/variant") |  (C++26)  |  [ P2637R3 ](https://wg21.link/P2637R3)  
` __cpp_lib_void_t ` |  [ std::void_t ](/w/cpp/types/void_t "cpp/types/void t") |  201411L  |  [ ` <type_traits> ` ](/w/cpp/header/type_traits "cpp/header/type traits") |  (C++17)  |  [ N3911 ](https://wg21.link/N3911)  
Total number of macros: 227  
  
###  [ [ edit ](/mwiki/index.php?title=cpp/feature_test&action=edit&section=4
"Edit section: Example") ]  Example

####  [ [ edit ](/mwiki/index.php?title=cpp/feature_test&action=edit&section=5
"Edit section: Normal usage") ]  Normal usage

Run this code

    
    
    #ifdef __has_include                           // Check if __has_include is present
    #  if __has_include(<optional>)                // Check for a standard library
    #    include <optional>
    #  elif __has_include(<experimental/optional>) // Check for an experimental version
    #    include <experimental/optional>
    #  elif __has_include(<boost/optional.hpp>)    // Try with an external lib