diff --git a/atom/src/defaultvaluebehavior.cpp b/atom/src/defaultvaluebehavior.cpp index 4a612fcf..497a2c57 100644 --- a/atom/src/defaultvaluebehavior.cpp +++ b/atom/src/defaultvaluebehavior.cpp @@ -187,8 +187,7 @@ typedef PyObject* ( *handler )( Member* member, CAtom* atom ); -static handler -handlers[] = { +static const std::array handlers = { no_op_handler, static_handler, list_handler, @@ -205,7 +204,6 @@ handlers[] = { member_method_object_handler }; -static_assert( sizeof(handlers) / sizeof(handler) == DefaultValue::Mode::Last, "Handler missing" ); } // namespace diff --git a/atom/src/delattrbehavior.cpp b/atom/src/delattrbehavior.cpp index a466c21b..fb43db04 100644 --- a/atom/src/delattrbehavior.cpp +++ b/atom/src/delattrbehavior.cpp @@ -180,8 +180,7 @@ typedef int ( *handler )( Member* member, CAtom* atom ); -static handler -handlers[] = { +static const std::array handlers = { no_op_handler, slot_handler, constant_handler, @@ -192,8 +191,6 @@ handlers[] = { property_handler }; -static_assert( sizeof(handlers) / sizeof(handler) == DelAttr::Mode::Last, "Handler missing" ); - } // namespace diff --git a/atom/src/getattrbehavior.cpp b/atom/src/getattrbehavior.cpp index bcc6cf61..97477533 100644 --- a/atom/src/getattrbehavior.cpp +++ b/atom/src/getattrbehavior.cpp @@ -243,8 +243,7 @@ typedef PyObject* ( *handler )( Member* member, CAtom* atom ); -static handler -handlers[] = { +static const std::array handlers = { no_op_handler, slot_handler, event_handler, @@ -259,7 +258,6 @@ handlers[] = { member_method_object_handler }; -static_assert( sizeof(handlers) / sizeof(handler) == GetAttr::Mode::Last, "Handler missing" ); } // namespace diff --git a/atom/src/getstatebehavior.cpp b/atom/src/getstatebehavior.cpp index 157417bd..d7a796ab 100644 --- a/atom/src/getstatebehavior.cpp +++ b/atom/src/getstatebehavior.cpp @@ -117,8 +117,7 @@ typedef PyObject* ( *handler )( Member* member, CAtom* atom ); -static handler -handlers[] = { +static const std::array handlers = { include_handler, // We want the include handler to be the default one exclude_handler, include_non_default_handler, @@ -127,7 +126,6 @@ handlers[] = { member_method_object_handler }; -static_assert( sizeof(handlers) / sizeof(handler) == GetState::Mode::Last, "Handler missing" ); } // namespace diff --git a/atom/src/member.h b/atom/src/member.h index 7c84f8d9..cdc11218 100644 --- a/atom/src/member.h +++ b/atom/src/member.h @@ -7,6 +7,7 @@ |----------------------------------------------------------------------------*/ #pragma once +#include #include #include #include "inttypes.h" diff --git a/atom/src/postgetattrbehavior.cpp b/atom/src/postgetattrbehavior.cpp index 579ecea2..3b99145c 100644 --- a/atom/src/postgetattrbehavior.cpp +++ b/atom/src/postgetattrbehavior.cpp @@ -87,8 +87,7 @@ typedef PyObject* ( *handler )( Member* member, CAtom* atom, PyObject* value ); -static handler -handlers[] = { +static const std::array handlers = { no_op_handler, delegate_handler, object_method_value_handler, @@ -96,7 +95,6 @@ handlers[] = { member_method_object_value_handler }; -static_assert( sizeof(handlers) / sizeof(handler) == PostGetAttr::Mode::Last, "Handler missing" ); } // namespace diff --git a/atom/src/postsetattrbehavior.cpp b/atom/src/postsetattrbehavior.cpp index b997760b..90cf8163 100644 --- a/atom/src/postsetattrbehavior.cpp +++ b/atom/src/postsetattrbehavior.cpp @@ -100,8 +100,7 @@ typedef int ( *handler )( Member* member, CAtom* atom, PyObject* oldvalue, PyObject* newvalue ); -static handler -handlers[] = { +static const std::array handlers = { no_op_handler, delegate_handler, object_method_old_new_handler, @@ -109,7 +108,6 @@ handlers[] = { member_method_object_old_new_handler }; -static_assert( sizeof(handlers) / sizeof(handler) == PostSetAttr::Mode::Last, "Handler missing" ); } // namespace diff --git a/atom/src/postvalidatebehavior.cpp b/atom/src/postvalidatebehavior.cpp index 7a1ec082..6dcc7b0e 100644 --- a/atom/src/postvalidatebehavior.cpp +++ b/atom/src/postvalidatebehavior.cpp @@ -91,8 +91,7 @@ typedef PyObject* ( *handler )( Member* member, CAtom* atom, PyObject* oldvalue, PyObject* newvalue ); -static handler -handlers[] = { +static const std::array handlers = { no_op_handler, delegate_handler, object_method_old_new_handler, @@ -100,7 +99,6 @@ handlers[] = { member_method_object_old_new_handler }; -static_assert( sizeof(handlers) / sizeof(handler) == PostValidate::Mode::Last, "Handler missing" ); } // namespace diff --git a/atom/src/setattrbehavior.cpp b/atom/src/setattrbehavior.cpp index e578e302..83c5165f 100644 --- a/atom/src/setattrbehavior.cpp +++ b/atom/src/setattrbehavior.cpp @@ -363,8 +363,7 @@ typedef int ( *handler )( Member* member, CAtom* atom, PyObject* value ); -static handler -handlers[] = { +static const std::array handlers = { no_op_handler, slot_handler, constant_handler, @@ -380,7 +379,6 @@ handlers[] = { member_method_object_value_handler }; -static_assert( sizeof(handlers) / sizeof(handler) == SetAttr::Mode::Last, "Handler missing" ); } // namespace diff --git a/atom/src/validatebehavior.cpp b/atom/src/validatebehavior.cpp index b91c6603..e655c789 100644 --- a/atom/src/validatebehavior.cpp +++ b/atom/src/validatebehavior.cpp @@ -964,8 +964,7 @@ typedef PyObject* ( *handler )( Member* member, CAtom* atom, PyObject* oldvalue, PyObject* newvalue ); -static handler -handlers[] = { +static const std::array handlers = { no_op_handler, bool_handler, long_handler, @@ -1000,7 +999,6 @@ handlers[] = { member_method_object_old_new_handler }; -static_assert( sizeof(handlers) / sizeof(handler) == Validate::Mode::Last, "Handler missing" ); } // namespace