Skip to content

String-like conversion #410

@henryiii

Description

@henryiii

In previous versions of CLI11, string-like types (Such as ROOT's TString) could be directly used in add_option. This now fails:

In file included from /home/travis/build/GooFit/GooFit/extern/CLI11/include/CLI/CLI.hpp:29:0,
1533                 from /home/travis/build/GooFit/GooFit/include/goofit/Application.h:5,
1534                 from /home/travis/build/GooFit/GooFit/examples/TDDP4/TDDP4.cu:7:
1535/home/travis/build/GooFit/GooFit/extern/CLI11/include/CLI/App.hpp: In instantiation of ‘CLI::Option* CLI::App::add_option(std::__cxx11::string, AssignTo&, std::__cxx11::string, bool) [with AssignTo = TString; ConvertTo = TString; typename std::enable_if<(! std::is_const<ConvertTo>::value), CLI::detail::enabler>::type <anonymous> = (CLI::detail::type)0; std::__cxx11::string = std::__cxx11::basic_string<char>]’:
1536/home/travis/build/GooFit/GooFit/examples/TDDP4/TDDP4.cu:30:72:   required from here
1537/home/travis/build/GooFit/GooFit/extern/CLI11/include/CLI/App.hpp:600:17: error: no matching function for call to ‘CLI::App::add_option(std::__cxx11::string&, CLI::App::add_option(std::__cxx11::string, AssignTo&, std::__cxx11::string, bool) [with AssignTo = TString; ConvertTo = TString; typename std::enable_if<(! std::is_const<ConvertTo>::value), CLI::detail::enabler>::type <anonymous> = (CLI::detail::type)0; std::__cxx11::string = std::__cxx11::basic_string<char>]::<lambda(const results_t&)>&, std::__cxx11::string&, bool&, CLI::App::add_option(std::__cxx11::string, AssignTo&, std::__cxx11::string, bool) [with AssignTo = TString; ConvertTo = TString; typename std::enable_if<(! std::is_const<ConvertTo>::value), CLI::detail::enabler>::type <anonymous> = (CLI::detail::type)0; std::__cxx11::string = std::__cxx11::basic_string<char>]::<lambda()>)’
1538         Option *opt = add_option(option_name, fun, option_description, defaulted, [&variable]() {
1539                 ^~~
1540/home/travis/build/GooFit/GooFit/extern/CLI11/include/CLI/App.hpp:546:13: note: candidate: CLI::Option* CLI::App::add_option(std::__cxx11::string, CLI::callback_t, std::__cxx11::string, bool, std::function<std::__cxx11::basic_string<char>()>)
1541     Option *add_option(std::string option_name,
1542             ^~~~~~~~~~
1543/home/travis/build/GooFit/GooFit/extern/CLI11/include/CLI/App.hpp:546:13: note:   no known conversion for argument 5 from ‘CLI::App::add_option(std::__cxx11::string, AssignTo&, std::__cxx11::string, bool) [with AssignTo = TString; ConvertTo = TString; typename std::enable_if<(! std::is_const<ConvertTo>::value), CLI::detail::enabler>::type <anonymous> = (CLI::detail::type)0; std::__cxx11::string = std::__cxx11::basic_string<char>]::<lambda()>’ to ‘std::function<std::__cxx11::basic_string<char>()>’
1544/home/travis/build/GooFit/GooFit/extern/CLI11/include/CLI/App.hpp:591:13: note: candidate: template<class AssignTo, class ConvertTo, typename std::enable_if<(! std::is_const<ConvertTo>::value), CLI::detail::enabler>::type <anonymous> > CLI::Option* CLI::App::add_option(std::__cxx11::string, AssignTo&, std::__cxx11::string, bool)
1545     Option *add_option(std::string option_name,
1546             ^~~~~~~~~~
1547/home/travis/build/GooFit/GooFit/extern/CLI11/include/CLI/App.hpp:591:13: note:   template argument deduction/substitution failed:
1548/home/travis/build/GooFit/GooFit/extern/CLI11/include/CLI/App.hpp:600:17: note:   candidate expects 4 arguments, 5 provided
1549         Option *opt = add_option(option_name, fun, option_description, defaulted, [&variable]() {
1550                 ^~~
1551/home/travis/build/GooFit/GooFit/extern/CLI11/include/CLI/App.hpp:637:13: note: candidate: CLI::Option* CLI::App::add_option(std::__cxx11::string)
1552     Option *add_option(std::string option_name) {
1553             ^~~~~~~~~~
1554/home/travis/build/GooFit/GooFit/extern/CLI11/include/CLI/App.hpp:637:13: note:   candidate expects 1 argument, 5 provided
1555/home/travis/build/GooFit/GooFit/extern/CLI11/include/CLI/App.hpp:645:13: note: candidate: template<class T, typename std::enable_if<(std::is_const< <template-parameter-1-1> >::value && std::is_constructible<std::__cxx11::basic_string<char>, T>::value), CLI::detail::enabler>::type <anonymous> > CLI::Option* CLI::App::add_option(std::__cxx11::string, T&)
1556     Option *add_option(std::string option_name, T &option_description) {
1557             ^~~~~~~~~~
1558/home/travis/build/GooFit/GooFit/extern/CLI11/include/CLI/App.hpp:645:13: note:   template argument deduction/substitution failed:
1559/home/travis/build/GooFit/GooFit/extern/CLI11/include/CLI/App.hpp:600:17: note:   candidate expects 2 arguments, 5 provided
1560         Option *opt = add_option(option_name, fun, option_description, defaulted, [&variable]() {
1561                 ^~~
1562examples/TDDP4/CMakeFiles/TDDP4.dir/build.make:62: recipe for target 'examples/TDDP4/CMakeFiles/TDDP4.dir/TDDP4.cu.o' failed

@phlptp, is this a side effect of the various optional and variant support changes? Is it necessary?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions