unable to customize parse function for double_constructible types in C++20. #566
Closed
Description
Consider following code:
All works fine with C++14 & C++17.
But failed to call my function in C++20.
Tested under Visual Studio 16.9.0 with "/std:c++latest".
#include <CLI/App.hpp>
#include <CLI/CLI.hpp>
#include <iostream>
#include <sstream>
template <class T = int>
struct Values
{
T a;
T b;
T c;
};
using DoubleValues = Values<double>;
namespace CLI
{
auto &&operator>>(std::istringstream &in, Values<double> &v)
{
std::string input;
in >> input;
std::cout
<< "called correct function " __FUNCTION__ " ! "
"val: "
<< input << std::endl;
return in;
}
bool lexical_cast(const std::string &input,
Values<double> &v)
{
std::cout
<< "called correct function " __FUNCTION__ " ! "
"val: "
<< input << std::endl;
return true;
}
};// namespace CLI
DoubleValues doubles;
void argparse(CLI::Option_group *group)
{
group->add_option("--fee-rate", doubles)
->envname("FEE_RATE")
->default_str("0");
}
int main(int argc, char **argv)
{
CLI::App app;
argparse(app.add_option_group("param"));
CLI11_PARSE(app, argc, argv);
return 0;
}