File tree Expand file tree Collapse file tree 5 files changed +12
-21
lines changed Expand file tree Collapse file tree 5 files changed +12
-21
lines changed Original file line number Diff line number Diff line change 46
46
- uses : actions/checkout@v4
47
47
- name : test
48
48
run : bazel test --cxxopt='-Werror' --cxxopt='-std=c++20' --repo_env=CC=clang --test_output=errors ...
49
-
50
- windows-latest-cpp20-cmake-mvsc :
51
- runs-on : windows-2019
52
- steps :
53
- - name : checkout
54
- uses : actions/checkout@v4
55
- - name : cmake build
56
- run : |
57
- cmake --preset msvc-16-config-debug
58
- cmake --build --preset msvc-16-build-debug
Original file line number Diff line number Diff line change @@ -96,14 +96,15 @@ class InvocableMapEntry {
96
96
// the constexpr-ness of the string can't be propagated. This essentially
97
97
// means you get one shot at defining the function.
98
98
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
+ ""))) {
103
104
static_assert (std::is_base_of_v<InvocableMapEntry, CrtpBase>,
104
105
" You must derive from the invocable map." );
105
106
106
- return (*static_cast <CrtpBase*>(this ))
107
+ return (*static_cast <const CrtpBase*>(this ))
107
108
.template InvocableMapCall <I, Args...>(key,
108
109
std::forward<Args>(args)...);
109
110
}
Original file line number Diff line number Diff line change @@ -64,8 +64,8 @@ class InvocableMap20 {
64
64
#if __cplusplus >= 202002L
65
65
public:
66
66
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 ))
69
69
.template InvocableMap20Call <Idx, key_literal, Args...>(
70
70
std::forward<Args>(args)...);
71
71
}
@@ -82,7 +82,7 @@ class InvocableMap20 {
82
82
}
83
83
84
84
template <StringLiteral string_literal, typename ... Args>
85
- constexpr auto Call (Args&&... args) {
85
+ constexpr auto Call (Args&&... args) const {
86
86
return Do<string_literal,
87
87
SelectCandidate (
88
88
string_literal,
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ class SampleClassNowExposingCallOperator1
53
53
&NameContainer::container1_>;
54
54
55
55
template <size_t I, StringLiteral key_literal, typename ... Args>
56
- auto InvocableMap20Call (Args&&... ts) {
56
+ auto InvocableMap20Call (Args&&... ts) const {
57
57
if (std::string_view (key_literal.value ) == " Foo" ) {
58
58
EXPECT_TRUE (I == 0 );
59
59
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
54
54
friend class jni ::metaprogramming::InvocableMapEntry;
55
55
56
56
template <size_t I, typename ... Args>
57
- auto InvocableMapCall (const char * key, Args&&... ts) {
57
+ auto InvocableMapCall (const char * key, Args&&... ts) const {
58
58
if (std::string_view (key) == " Foo" ) {
59
59
EXPECT_TRUE (I == 0 );
60
60
EXPECT_TRUE ((std::is_same_v<std::tuple<Args...>, std::tuple<int >>));
@@ -99,7 +99,7 @@ class SampleClassNowExposingCallOperator2
99
99
friend class jni ::metaprogramming::InvocableMapEntry;
100
100
101
101
template <size_t I, typename ... Args>
102
- auto InvocableMapCall (const char * key, Args&&... args) {
102
+ auto InvocableMapCall (const char * key, Args&&... args) const {
103
103
if (std::string_view (key) == " Fizz" ) {
104
104
EXPECT_TRUE (I == 0 );
105
105
EXPECT_TRUE ((std::is_same_v<std::tuple<Args...>, std::tuple<int >>));
You can’t perform that action at this time.
0 commit comments