Add PYBIND11_EXPAND_SIDE_EFFECTS macro

This allows calling of functions (typically void) over a parameter
pack, replacing usage such as:

    bool unused[] = { (voidfunc(param_pack_arg), false)..., false };
    (void) unused;

with a much cleaner:

    PYBIND11_EXPAND_SIDE_EFFECTS(voidfunc(param_pack_arg));
diff --git a/include/pybind11/common.h b/include/pybind11/common.h
index ddf966e..baa84b2 100644
--- a/include/pybind11/common.h
+++ b/include/pybind11/common.h
@@ -504,6 +504,14 @@
 /// Ignore that a variable is unused in compiler warnings
 inline void ignore_unused(const int *) { }
 
+/// Apply a function over each element of a parameter pack
+#ifdef __cpp_fold_expressions
+#define PYBIND11_EXPAND_SIDE_EFFECTS(PATTERN) (((PATTERN), void()), ...)
+#else
+using expand_side_effects = bool[];
+#define PYBIND11_EXPAND_SIDE_EFFECTS(PATTERN) pybind11::detail::expand_side_effects{ ((PATTERN), void(), false)..., false }
+#endif
+
 NAMESPACE_END(detail)
 
 /// Returns a named pointer that is shared among all extension modules (using the same
diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h
index c4e6131..21d911c 100644
--- a/include/pybind11/pybind11.h
+++ b/include/pybind11/pybind11.h
@@ -947,8 +947,7 @@
         set_operator_new<type>(&record);
 
         /* Register base classes specified via template arguments to class_, if any */
-        bool unused[] = { (add_base<options>(record), false)..., false };
-        (void) unused;
+        PYBIND11_EXPAND_SIDE_EFFECTS(add_base<options>(record));
 
         /* Process optional arguments, if any */
         process_attributes<Extra...>::init(extra..., &record);