Skip to content

Instantly share code, notes, and snippets.

@ckerr
Created September 14, 2021 00:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ckerr/b5313021e52b3060f8b678152f177095 to your computer and use it in GitHub Desktop.
Save ckerr/b5313021e52b3060f8b678152f177095 to your computer and use it in GitHub Desktop.
gcc 5.5-friendly way of including optional
#if !defined(__has_include) || __has_include(<optional>)
#include <optional>
#elif __has_include(<experimental/optional>)
#include <experimental/optional>
namespace std { template<typename T> using optional = experimental::optional<T>; }
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment