diff --git a/include/CLI/Optional.hpp b/include/CLI/Optional.hpp index 9e1315e6..5b7d3e0b 100644 --- a/include/CLI/Optional.hpp +++ b/include/CLI/Optional.hpp @@ -3,7 +3,7 @@ // Distributed under the 3-Clause BSD License. See accompanying // file LICENSE or https://github.com/CLIUtils/CLI11 for details. -#include +#include #include "CLI/Macros.hpp" @@ -15,11 +15,11 @@ #define CLI11_STD_OPTIONAL #endif #endif -#if defined(CPP11_CPP14) && __has_include() +#if defined(CLI11_CPP14) && __has_include() #include #define CLI11_EXPERIMENTAL_OPTIONAL #endif -#if __has_include() +#if __has_include() #include #define CLI11_BOOST_OPTIONAL #endif @@ -44,16 +44,16 @@ template std::istream &operator>>(std::istream &in, std::experiment val = v; return in; } +#endif #ifdef CLI11_BOOST_OPTIONAL -template std::istream &operator>>(std::istream &in, boost::optional &val) { +template std::istringstream &operator>>(std::istringstream &in, boost::optional &val) { T v; in >> v; val = v; return in; } #endif -#endif // Export the best optional to the CLI namespace #if defined(CLI11_STD_OPTIONAL) diff --git a/tests/OptionalTest.cpp b/tests/OptionalTest.cpp index d6767a46..305f4274 100644 --- a/tests/OptionalTest.cpp +++ b/tests/OptionalTest.cpp @@ -6,7 +6,7 @@ #ifdef CLI11_OPTIONAL TEST_F(TApp, OptionalTest) { - optional opt; + CLI::optional opt; app.add_option("-c,--count", opt); run(); EXPECT_FALSE(opt); diff --git a/tests/informational.cpp b/tests/informational.cpp index 5c219baf..89c73ff9 100644 --- a/tests/informational.cpp +++ b/tests/informational.cpp @@ -31,8 +31,7 @@ int main() { #ifdef CLI11_OPTIONAL std::cout << " [Available as CLI::optional]"; #else - std::cout - << " No optional library found\n"; + std::cout << " No optional library found\n"; #endif #ifdef CLI11_STD_OPTIONAL