Skip to content

Commit de6b6ae

Browse files
authored
Update std-visit-cpp-for-the-antiquated-2.md
1 parent 8c5d362 commit de6b6ae

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

content/Blog/std-visit-cpp-for-the-antiquated-2.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ Slug: std-visit-cpp-for-the-antiquated-2
3232
#include <variant>
3333
#include <type_traits>
3434

35+
template<typename T>
36+
inline constexpr bool always_false_v = false;
37+
3538
int main() {
3639
std::vector<std::variant<int, float, std::string>> items {
3740
10,
@@ -49,7 +52,7 @@ int main() {
4952
} else if constexpr (std::is_same_v<T, std::string>) {
5053
std::cout << "std::string: " << arg << std::endl;
5154
} else {
52-
static_assert(always_false<T>::value, "Unhandled type!");
55+
static_assert(always_false_v<>, "Unhandled type!");
5356
}
5457
}, item);
5558
}

0 commit comments

Comments
 (0)