File tree Expand file tree Collapse file tree 4 files changed +12
-11
lines changed
Expand file tree Collapse file tree 4 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -96,14 +96,15 @@ class InvocableMapEntry {
9696 // the constexpr-ness of the string can't be propagated. This essentially
9797 // means you get one shot at defining the function.
9898 template <typename ... Args>
99- constexpr auto operator ()(const char * key, Args&&... args) __attribute__((
100- enable_if (std::string_view(key) ==
101- std::get<I>(tup_container_v.*nameable_member).name_,
102- ""))) {
99+ constexpr auto operator ()(const char * key, Args&&... args) const
100+ __attribute__((
101+ enable_if (std::string_view(key) ==
102+ std::get<I>(tup_container_v.*nameable_member).name_,
103+ ""))) {
103104 static_assert (std::is_base_of_v<InvocableMapEntry, CrtpBase>,
104105 " You must derive from the invocable map." );
105106
106- return (*static_cast <CrtpBase*>(this ))
107+ return (*static_cast <const CrtpBase*>(this ))
107108 .template InvocableMapCall <I, Args...>(key,
108109 std::forward<Args>(args)...);
109110 }
Original file line number Diff line number Diff line change @@ -64,8 +64,8 @@ class InvocableMap20 {
6464#if __cplusplus >= 202002L
6565 public:
6666 template <StringLiteral key_literal, std::size_t Idx, typename ... Args>
67- constexpr auto Do (Args&&... args) {
68- return (*static_cast <CrtpBase*>(this ))
67+ constexpr auto Do (Args&&... args) const {
68+ return (*static_cast <const CrtpBase*>(this ))
6969 .template InvocableMap20Call <Idx, key_literal, Args...>(
7070 std::forward<Args>(args)...);
7171 }
@@ -82,7 +82,7 @@ class InvocableMap20 {
8282 }
8383
8484 template <StringLiteral string_literal, typename ... Args>
85- constexpr auto Call (Args&&... args) {
85+ constexpr auto Call (Args&&... args) const {
8686 return Do<string_literal,
8787 SelectCandidate (
8888 string_literal,
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ class SampleClassNowExposingCallOperator1
5353 &NameContainer::container1_>;
5454
5555 template <size_t I, StringLiteral key_literal, typename ... Args>
56- auto InvocableMap20Call (Args&&... ts) {
56+ auto InvocableMap20Call (Args&&... ts) const {
5757 if (std::string_view (key_literal.value ) == " Foo" ) {
5858 EXPECT_TRUE (I == 0 );
5959 EXPECT_TRUE ((std::is_same_v<std::tuple<Args...>, std::tuple<int >>));
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ class SampleClassNowExposingCallOperator1
5454 friend class jni ::metaprogramming::InvocableMapEntry;
5555
5656 template <size_t I, typename ... Args>
57- auto InvocableMapCall (const char * key, Args&&... ts) {
57+ auto InvocableMapCall (const char * key, Args&&... ts) const {
5858 if (std::string_view (key) == " Foo" ) {
5959 EXPECT_TRUE (I == 0 );
6060 EXPECT_TRUE ((std::is_same_v<std::tuple<Args...>, std::tuple<int >>));
@@ -99,7 +99,7 @@ class SampleClassNowExposingCallOperator2
9999 friend class jni ::metaprogramming::InvocableMapEntry;
100100
101101 template <size_t I, typename ... Args>
102- auto InvocableMapCall (const char * key, Args&&... args) {
102+ auto InvocableMapCall (const char * key, Args&&... args) const {
103103 if (std::string_view (key) == " Fizz" ) {
104104 EXPECT_TRUE (I == 0 );
105105 EXPECT_TRUE ((std::is_same_v<std::tuple<Args...>, std::tuple<int >>));
You can’t perform that action at this time.
0 commit comments