Skip to content

Commit

Permalink
Add missing <utility> include
Browse files Browse the repository at this point in the history
After upgrading g++ package to 12.1.0 on archlinux I see the following
compilation error:

  /usr/include/argparse/argparse.hpp: In member function ‘void argparse::ArgumentParser::index_argument(list_iterator)’:
  /usr/include/argparse/argparse.hpp:1167:34: error: ‘as_const’ is not a member of ‘std’; did you mean ‘is_const’?
   1167 |     for (const auto &name : std::as_const(it->m_names)) {
        |                                  ^~~~~~~~
        |                                  is_const

It turns out that std::as_const comes from <utility> header [1] which
was not explicitly included.

[1] https://en.cppreference.com/w/cpp/utility/as_const
  • Loading branch information
Tomáš Pecka committed May 15, 2022
1 parent f5ea927 commit 95d4850
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions include/argparse/argparse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ SOFTWARE.
#include <string_view>
#include <tuple>
#include <type_traits>
#include <utility>
#include <variant>
#include <vector>

Expand Down

0 comments on commit 95d4850

Please sign in to comment.