mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-05-03 05:53:52 +00:00
Style and typo fix
This commit is contained in:
parent
8482b600fc
commit
67c4eb71e5
@ -3,7 +3,7 @@
|
||||
// Distributed under the 3-Clause BSD License. See accompanying
|
||||
// file LICENSE or https://github.com/CLIUtils/CLI11 for details.
|
||||
|
||||
#include <sstream>
|
||||
#include <istream>
|
||||
|
||||
#include "CLI/Macros.hpp"
|
||||
|
||||
@ -15,11 +15,11 @@
|
||||
#define CLI11_STD_OPTIONAL
|
||||
#endif
|
||||
#endif
|
||||
#if defined(CPP11_CPP14) && __has_include(<experimental/optional>)
|
||||
#if defined(CLI11_CPP14) && __has_include(<experimental/optional>)
|
||||
#include <experimental/optional>
|
||||
#define CLI11_EXPERIMENTAL_OPTIONAL
|
||||
#endif
|
||||
#if __has_include(<boost/optional>)
|
||||
#if __has_include(<boost/optional.hpp>)
|
||||
#include <boost/optional.hpp>
|
||||
#define CLI11_BOOST_OPTIONAL
|
||||
#endif
|
||||
@ -44,16 +44,16 @@ template <typename T> std::istream &operator>>(std::istream &in, std::experiment
|
||||
val = v;
|
||||
return in;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CLI11_BOOST_OPTIONAL
|
||||
template <typename T> std::istream &operator>>(std::istream &in, boost::optional<T> &val) {
|
||||
template <typename T> std::istringstream &operator>>(std::istringstream &in, boost::optional<T> &val) {
|
||||
T v;
|
||||
in >> v;
|
||||
val = v;
|
||||
return in;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Export the best optional to the CLI namespace
|
||||
#if defined(CLI11_STD_OPTIONAL)
|
||||
|
@ -6,7 +6,7 @@
|
||||
#ifdef CLI11_OPTIONAL
|
||||
|
||||
TEST_F(TApp, OptionalTest) {
|
||||
optional<int> opt;
|
||||
CLI::optional<int> opt;
|
||||
app.add_option("-c,--count", opt);
|
||||
run();
|
||||
EXPECT_FALSE(opt);
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user