Commit 67c4eb71e5060ab1b28bd8a35bf8637585ef67ce

Authored by Henry Fredrick Schreiner
Committed by Henry Schreiner
1 parent 8482b600

Style and typo fix

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