blob: b9c055e060456c2bfa1fc999da7befd69ce9c3f3 [file] [log] [blame]
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef LIB_STDCOMPAT_VERSION_H_
#define LIB_STDCOMPAT_VERSION_H_
// This <version> polyfills is meant to provide the feature testing macros for the rest of
// the stdcompat library. It is not meant to be a full polyfill of <version>.
#if __has_include(<version>) && !defined(LIB_STDCOMPAT_USE_POLYFILLS)
#include <version>
#elif __cplusplus > 201703L && !defined(LIB_STDCOMPAT_USE_POLYFILLS)
#error "cpp=std20 must provide a '<version>' header."
#else
#if __has_include(<optional>) && !defined(__cpp_lib_optional) && __cplusplus >= 201606L
#define __cpp_lib_optional 201606L
#endif
#if __has_include(<string_view>) && !defined(__cpp_lib_string_view) && __cplusplus >= 201606L
#define __cpp_lib_string_view 201606L
#endif
#if !defined(__cpp_lib_void_t) && __cplusplus >= 201411L
#define __cpp_lib_void_t 201411L
#endif
#if !defined(__cpp_lib_logical_traits) && __cplusplus >= 201510L
#define __cpp_lib_logical_traits 201510L
#endif
#endif // __has_include(<version>) && !defined(LIB_STDCOMPAT_USE_POLYFILLS)
#endif // LIB_STDCOMPAT_VERSION_H_