title: Using std::optional in a C++11 context
body: <p>I'm writing a small C++11 library in which I believe <code>std::optional</code> would be a nice addition in some functions which can return <code>nullptr</code>. However, <code>std::optional</code> is a C++17 feature. Since being C++11 is a requirement, I'm looking for ways to use <code>std::optional</code> while keeping compatibility.</p>
  
  <p>I found that <a href="https://en.cppreference.com/w/User:D41D8CD98F/feature_testing_macros#C.2B.2B17" rel="nofollow noreferrer">feature macros</a> can be tested. I suppose I could use it to detect whether <code>std::optional</code> is available... but what's the best approach when it isn't?</p>
  
  <p>Should I provide my own <code>std::optional</code> implementation?</p>
  
  <p>Return <code>nullptr</code> when <code>std::optional</code> isn't available? (Likely to mess my code.)</p>
  
  <p>Or give up on the idea and keep returning <code>nullptr</code> only?</p>