mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-05-03 14:03: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
|
// Distributed under the 3-Clause BSD License. See accompanying
|
||||||
// file LICENSE or https://github.com/CLIUtils/CLI11 for details.
|
// file LICENSE or https://github.com/CLIUtils/CLI11 for details.
|
||||||
|
|
||||||
#include <sstream>
|
#include <istream>
|
||||||
|
|
||||||
#include "CLI/Macros.hpp"
|
#include "CLI/Macros.hpp"
|
||||||
|
|
||||||
@ -15,11 +15,11 @@
|
|||||||
#define CLI11_STD_OPTIONAL
|
#define CLI11_STD_OPTIONAL
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if defined(CPP11_CPP14) && __has_include(<experimental/optional>)
|
#if defined(CLI11_CPP14) && __has_include(<experimental/optional>)
|
||||||
#include <experimental/optional>
|
#include <experimental/optional>
|
||||||
#define CLI11_EXPERIMENTAL_OPTIONAL
|
#define CLI11_EXPERIMENTAL_OPTIONAL
|
||||||
#endif
|
#endif
|
||||||
#if __has_include(<boost/optional>)
|
#if __has_include(<boost/optional.hpp>)
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
#define CLI11_BOOST_OPTIONAL
|
#define CLI11_BOOST_OPTIONAL
|
||||||
#endif
|
#endif
|
||||||
@ -44,16 +44,16 @@ template <typename T> std::istream &operator>>(std::istream &in, std::experiment
|
|||||||
val = v;
|
val = v;
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CLI11_BOOST_OPTIONAL
|
#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;
|
T v;
|
||||||
in >> v;
|
in >> v;
|
||||||
val = v;
|
val = v;
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
// Export the best optional to the CLI namespace
|
// Export the best optional to the CLI namespace
|
||||||
#if defined(CLI11_STD_OPTIONAL)
|
#if defined(CLI11_STD_OPTIONAL)
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#ifdef CLI11_OPTIONAL
|
#ifdef CLI11_OPTIONAL
|
||||||
|
|
||||||
TEST_F(TApp, OptionalTest) {
|
TEST_F(TApp, OptionalTest) {
|
||||||
optional<int> opt;
|
CLI::optional<int> opt;
|
||||||
app.add_option("-c,--count", opt);
|
app.add_option("-c,--count", opt);
|
||||||
run();
|
run();
|
||||||
EXPECT_FALSE(opt);
|
EXPECT_FALSE(opt);
|
||||||
|
@ -31,8 +31,7 @@ int main() {
|
|||||||
#ifdef CLI11_OPTIONAL
|
#ifdef CLI11_OPTIONAL
|
||||||
std::cout << " [Available as CLI::optional]";
|
std::cout << " [Available as CLI::optional]";
|
||||||
#else
|
#else
|
||||||
std::cout
|
std::cout << " No optional library found\n";
|
||||||
<< " No optional library found\n";
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CLI11_STD_OPTIONAL
|
#ifdef CLI11_STD_OPTIONAL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user