Minor change to internal/optional.hp so that __has_include is used only if __cplusplus >= 201703

This commit is contained in:
Tristan Penman 2018-08-02 11:57:08 +10:00
parent a81780e8c7
commit c2f22fddf5

View File

@ -2,10 +2,14 @@
#ifndef __VALIJSON_OPTIONAL_HPP
#define __VALIJSON_OPTIONAL_HPP
// This should be removed once C++17 is widely available
#if __has_include(<optional>) && __cplusplus >= 201703
# include <optional>
#if __cplusplus >= 201703
// Visual C++ only supports __has_include in versions 14.12 and greater
# if !defined(_MSC_VER) || _MSC_VER >= 1912
# if __has_include(<optional>)
# include <optional>
namespace opt = std;
# endif
# endif
#else
# include <compat/optional.hpp>
namespace opt = std::experimental;