mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-05-06 23:23:53 +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)
|
#if defined(PYBIND11_CPP14)
|
||||||
#define CLI11_DEPRECATED(reason) [[deprecated(reason)]]
|
#define CLI11_DEPRECATED(reason) [[deprecated(reason)]]
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
#define CLI11_DEPRECATED(reason) __declspec(deprecated(reason))
|
||||||
#else
|
#else
|
||||||
#define CLI11_DEPRECATED(reason) __attribute__((deprecated(reason)))
|
#define CLI11_DEPRECATED(reason) __attribute__((deprecated(reason)))
|
||||||
#endif
|
#endif
|
||||||
|
@ -306,14 +306,17 @@ class Option : public OptionBase<Option> {
|
|||||||
Option *requires(Option *opt) { return needs(opt); }
|
Option *requires(Option *opt) { return needs(opt); }
|
||||||
|
|
||||||
/// Can find a string if needed \deprecated
|
/// 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) {
|
||||||
template <typename T = App> Option *requires(std::string opt_name) { return needs<T>(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
|
/// 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) {
|
template <typename A, typename B, typename... ARG> Option *requires(A opt, B opt1, ARG... args) {
|
||||||
needs(opt);
|
requires(opt);
|
||||||
return needs(opt1, args...);
|
return requires(opt1, args...);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#ifdef __has_include
|
#ifdef __has_include
|
||||||
#if __has_include(<optional>)
|
#if defined(CLI11_CPP17) && __has_include(<optional>)
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#define have_optional 1
|
#define have_optional 1
|
||||||
using std::experimental::optional;
|
using std::experimental::optional;
|
||||||
#elif __has_include(<experimental/optional>)
|
#elif defined(CPP11_CPP14) && __has_include(<experimental/optional>)
|
||||||
#include <experimental/optional>
|
#include <experimental/optional>
|
||||||
#define have_optional 1
|
#define have_optional 1
|
||||||
using std::optional;
|
using std::optional;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user