mirror of
https://github.com/pybind/pybind11.git
synced 2025-01-19 01:15:52 +00:00
Introduce detail::always_false<>
to make the new static_assert()
more readable.
This commit is contained in:
parent
4be50fe1a9
commit
8f87e21291
@ -1372,7 +1372,7 @@ template <typename D>
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
str_attr_accessor object_api<D>::attr_with_type_hint(const char *key) const {
|
str_attr_accessor object_api<D>::attr_with_type_hint(const char *key) const {
|
||||||
#if !defined(__cpp_inline_variables)
|
#if !defined(__cpp_inline_variables)
|
||||||
static_assert(!std::is_same<T, T>::value,
|
static_assert(always_false<T>::value,
|
||||||
"C++17 feature __cpp_inline_variables not available: "
|
"C++17 feature __cpp_inline_variables not available: "
|
||||||
"https://en.cppreference.com/w/cpp/language/static#Static_data_members");
|
"https://en.cppreference.com/w/cpp/language/static#Static_data_members");
|
||||||
#endif
|
#endif
|
||||||
|
@ -627,6 +627,9 @@ struct instance {
|
|||||||
static_assert(std::is_standard_layout<instance>::value,
|
static_assert(std::is_standard_layout<instance>::value,
|
||||||
"Internal error: `pybind11::detail::instance` is not standard layout!");
|
"Internal error: `pybind11::detail::instance` is not standard layout!");
|
||||||
|
|
||||||
|
template <typename>
|
||||||
|
struct always_false : std::false_type {};
|
||||||
|
|
||||||
/// from __cpp_future__ import (convenient aliases from C++14/17)
|
/// from __cpp_future__ import (convenient aliases from C++14/17)
|
||||||
#if defined(PYBIND11_CPP14)
|
#if defined(PYBIND11_CPP14)
|
||||||
using std::conditional_t;
|
using std::conditional_t;
|
||||||
|
Loading…
Reference in New Issue
Block a user