mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-04-29 12:13:52 +00:00
Fixes #1135. Adds enable check to certain to_string functions as some std::array operations were ambiguous. The addition of the capability to convert tuples to strings created an ambiguity in the case std::array, which acts like a tuple and a container. So it worked with the container conversion before, but could also work with the new tuple conversion. And we didn't have any tests to catch this. This PR resolves the ambiguity, and adds some tests to check that array is handled well. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
22 lines
616 B
C++
22 lines
616 B
C++
// Copyright (c) 2017-2025, University of Cincinnati, developed by Henry Schreiner
|
|
// under NSF AWARD 1414736 and by the respective contributors.
|
|
// All rights reserved.
|
|
//
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
// Code modified from Loic Gouarin(https://github.com/gouarin) https://github.com/CLIUtils/CLI11/issues/1135
|
|
|
|
#include <CLI/CLI.hpp>
|
|
#include <array>
|
|
#include <iostream>
|
|
|
|
int main(int argc, char **argv) {
|
|
std::array<int, 2> a{0, 1};
|
|
CLI::App app{"My app"};
|
|
app.add_option("--a", a, "an array")->capture_default_str();
|
|
app.parse(argc, argv);
|
|
|
|
std::cout << "pass\n";
|
|
return 0;
|
|
}
|