Skip to content

Commit

Permalink
Use __has_include to detect std::optional
Browse files Browse the repository at this point in the history
  • Loading branch information
jhasse committed Jun 20, 2019
1 parent c3d5ccb commit 99b5fb3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/main.hpp
Expand Up @@ -9,12 +9,12 @@
#include <memory>
#include <string>
#include <vector>
#ifdef __APPLE__
#if defined(__has_include) && __has_include(<optional>)
#include <optional>
template <class T> using optional = std::optional<T>;
#else
#include <experimental/optional>
using std::experimental::optional;
#else
#include <optional>
using std::optional;
#endif

namespace jngl {
Expand Down
10 changes: 5 additions & 5 deletions src/sdl/windowimpl.hpp
Expand Up @@ -2,14 +2,14 @@

#include "sdl.hpp"

#ifdef __APPLE__
#if defined(__has_include) && __has_include(<optional>)
#include <optional>
template <class T> using optional = std::optional<T>;
using std::nullopt;
#else
#include <experimental/optional>
using std::experimental::optional;
using std::experimental::nullopt;
#else
#include <optional>
using std::optional;
using std::nullopt;
#endif

namespace jngl {
Expand Down

0 comments on commit 99b5fb3

Please sign in to comment.