mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-05-02 21:53:51 +00:00
Fix for deprecated macro
This commit is contained in:
parent
d2d4f07fd4
commit
368f2cd9a6
@ -35,6 +35,8 @@ namespace CLI {
|
||||
|
||||
#if defined(PYBIND11_CPP14)
|
||||
#define CLI11_DEPRECATED(reason) [[deprecated(reason)]]
|
||||
#elif defined(_MSC_VER)
|
||||
#define CLI11_DEPRECATED(reason) __declspec(deprecated(reason))
|
||||
#else
|
||||
#define CLI11_DEPRECATED(reason) __attribute__((deprecated(reason)))
|
||||
#endif
|
||||
|
@ -306,14 +306,17 @@ class Option : public OptionBase<Option> {
|
||||
Option *requires(Option *opt) { return needs(opt); }
|
||||
|
||||
/// Can find a string if needed \deprecated
|
||||
CLI11_DEPRECATED("Use needs instead of requires (eventual keyword clash)")
|
||||
template <typename T = App> Option *requires(std::string opt_name) { return needs<T>(opt_name); }
|
||||
template <typename T = App> Option *requires(std::string opt_name) {
|
||||
for(const Option_p &opt : dynamic_cast<T *>(parent_)->options_)
|
||||
if(opt.get() != this && opt->check_name(opt_name))
|
||||
return requires(opt.get());
|
||||
throw IncorrectConstruction::MissingOption(opt_name);
|
||||
}
|
||||
|
||||
/// Any number supported, any mix of string and Opt \deprecated
|
||||
CLI11_DEPRECATED("Use needs instead of requires (eventual keyword clash)")
|
||||
template <typename A, typename B, typename... ARG> Option *requires(A opt, B opt1, ARG... args) {
|
||||
needs(opt);
|
||||
return needs(opt1, args...);
|
||||
requires(opt);
|
||||
return requires(opt1, args...);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2,11 +2,11 @@
|
||||
#include <iostream>
|
||||
|
||||
#ifdef __has_include
|
||||
#if __has_include(<optional>)
|
||||
#if defined(CLI11_CPP17) && __has_include(<optional>)
|
||||
#include <optional>
|
||||
#define have_optional 1
|
||||
using std::experimental::optional;
|
||||
#elif __has_include(<experimental/optional>)
|
||||
#elif defined(CPP11_CPP14) && __has_include(<experimental/optional>)
|
||||
#include <experimental/optional>
|
||||
#define have_optional 1
|
||||
using std::optional;
|
||||
|
Loading…
x
Reference in New Issue
Block a user