Commit 67c4eb71e5060ab1b28bd8a35bf8637585ef67ce
Committed by
Henry Schreiner
1 parent
8482b600
Style and typo fix
Showing
3 changed files
with
7 additions
and
8 deletions
include/CLI/Optional.hpp
| @@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
| 3 | // Distributed under the 3-Clause BSD License. See accompanying | 3 | // Distributed under the 3-Clause BSD License. See accompanying |
| 4 | // file LICENSE or https://github.com/CLIUtils/CLI11 for details. | 4 | // file LICENSE or https://github.com/CLIUtils/CLI11 for details. |
| 5 | 5 | ||
| 6 | -#include <sstream> | 6 | +#include <istream> |
| 7 | 7 | ||
| 8 | #include "CLI/Macros.hpp" | 8 | #include "CLI/Macros.hpp" |
| 9 | 9 | ||
| @@ -15,11 +15,11 @@ | @@ -15,11 +15,11 @@ | ||
| 15 | #define CLI11_STD_OPTIONAL | 15 | #define CLI11_STD_OPTIONAL |
| 16 | #endif | 16 | #endif |
| 17 | #endif | 17 | #endif |
| 18 | -#if defined(CPP11_CPP14) && __has_include(<experimental/optional>) | 18 | +#if defined(CLI11_CPP14) && __has_include(<experimental/optional>) |
| 19 | #include <experimental/optional> | 19 | #include <experimental/optional> |
| 20 | #define CLI11_EXPERIMENTAL_OPTIONAL | 20 | #define CLI11_EXPERIMENTAL_OPTIONAL |
| 21 | #endif | 21 | #endif |
| 22 | -#if __has_include(<boost/optional>) | 22 | +#if __has_include(<boost/optional.hpp>) |
| 23 | #include <boost/optional.hpp> | 23 | #include <boost/optional.hpp> |
| 24 | #define CLI11_BOOST_OPTIONAL | 24 | #define CLI11_BOOST_OPTIONAL |
| 25 | #endif | 25 | #endif |
| @@ -44,16 +44,16 @@ template <typename T> std::istream &operator>>(std::istream &in, std::experiment | @@ -44,16 +44,16 @@ template <typename T> std::istream &operator>>(std::istream &in, std::experiment | ||
| 44 | val = v; | 44 | val = v; |
| 45 | return in; | 45 | return in; |
| 46 | } | 46 | } |
| 47 | +#endif | ||
| 47 | 48 | ||
| 48 | #ifdef CLI11_BOOST_OPTIONAL | 49 | #ifdef CLI11_BOOST_OPTIONAL |
| 49 | -template <typename T> std::istream &operator>>(std::istream &in, boost::optional<T> &val) { | 50 | +template <typename T> std::istringstream &operator>>(std::istringstream &in, boost::optional<T> &val) { |
| 50 | T v; | 51 | T v; |
| 51 | in >> v; | 52 | in >> v; |
| 52 | val = v; | 53 | val = v; |
| 53 | return in; | 54 | return in; |
| 54 | } | 55 | } |
| 55 | #endif | 56 | #endif |
| 56 | -#endif | ||
| 57 | 57 | ||
| 58 | // Export the best optional to the CLI namespace | 58 | // Export the best optional to the CLI namespace |
| 59 | #if defined(CLI11_STD_OPTIONAL) | 59 | #if defined(CLI11_STD_OPTIONAL) |
tests/OptionalTest.cpp
| @@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
| 6 | #ifdef CLI11_OPTIONAL | 6 | #ifdef CLI11_OPTIONAL |
| 7 | 7 | ||
| 8 | TEST_F(TApp, OptionalTest) { | 8 | TEST_F(TApp, OptionalTest) { |
| 9 | - optional<int> opt; | 9 | + CLI::optional<int> opt; |
| 10 | app.add_option("-c,--count", opt); | 10 | app.add_option("-c,--count", opt); |
| 11 | run(); | 11 | run(); |
| 12 | EXPECT_FALSE(opt); | 12 | EXPECT_FALSE(opt); |
tests/informational.cpp
| @@ -31,8 +31,7 @@ int main() { | @@ -31,8 +31,7 @@ int main() { | ||
| 31 | #ifdef CLI11_OPTIONAL | 31 | #ifdef CLI11_OPTIONAL |
| 32 | std::cout << " [Available as CLI::optional]"; | 32 | std::cout << " [Available as CLI::optional]"; |
| 33 | #else | 33 | #else |
| 34 | - std::cout | ||
| 35 | - << " No optional library found\n"; | 34 | + std::cout << " No optional library found\n"; |
| 36 | #endif | 35 | #endif |
| 37 | 36 | ||
| 38 | #ifdef CLI11_STD_OPTIONAL | 37 | #ifdef CLI11_STD_OPTIONAL |