mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Add an additional configuration parameter to make it so automagic usertypes can be turned off, and document it.
Thanks @EliasDaler
This commit is contained in:
parent
5022c4d8f6
commit
c5f6680bf4
|
@ -101,6 +101,12 @@ Feature Config
|
||||||
* May come with a slight performance penalty: only recommended for those stuck with non-sol libraries that still need to leverage some of sol's power
|
* May come with a slight performance penalty: only recommended for those stuck with non-sol libraries that still need to leverage some of sol's power
|
||||||
* **Not** turned on by default under any settings: *this MUST be turned on manually*
|
* **Not** turned on by default under any settings: *this MUST be turned on manually*
|
||||||
|
|
||||||
|
``SOL_AUTOMAGICAL_TYPES_BY_DEFAULT`` triggers the following change:
|
||||||
|
* Either turns on (``!= 0``) or turns off (``== 0``) automagical usertype detection by default.
|
||||||
|
* Automagical usertypes search for specific C++ conventions to define common methods for the end-user.
|
||||||
|
* Some automagical methods might cause huge compiler errors, and some people have code bases with different conventions.
|
||||||
|
* Turned on by default. This *must be turned off manually*.
|
||||||
|
|
||||||
.. _config-memory:
|
.. _config-memory:
|
||||||
|
|
||||||
Memory Config
|
Memory Config
|
||||||
|
|
|
@ -234,4 +234,12 @@
|
||||||
#define SOL_SAFE_STACK_CHECK 0
|
#define SOL_SAFE_STACK_CHECK 0
|
||||||
#endif // use luaL_checkstack to check stack overflow / overrun
|
#endif // use luaL_checkstack to check stack overflow / overrun
|
||||||
|
|
||||||
|
// This macro gives automagic type checks by default.
|
||||||
|
// Some types don't quite conform to this, so a few people
|
||||||
|
// want it to be turned off globally, all the time.
|
||||||
|
// the trait can still be specialized to help with that.
|
||||||
|
#if !defined(SOL_AUTOMAGICAL_TYPES_BY_DEFAULT)
|
||||||
|
#define SOL_AUTOMAGICAL_TYPES_BY_DEFAULT 1
|
||||||
|
#endif // make is_automagical on/off by default
|
||||||
|
|
||||||
#endif // SOL_CONFIG_HPP
|
#endif // SOL_CONFIG_HPP
|
||||||
|
|
|
@ -1289,8 +1289,10 @@ namespace sol {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_automagical
|
struct is_automagical
|
||||||
: std::integral_constant<bool,
|
: std::integral_constant<bool,
|
||||||
std::is_array_v<
|
(SOL_AUTOMAGICAL_TYPES_BY_DEFAULT != 0)
|
||||||
meta::unqualified_t<T>> || (!std::is_same_v<meta::unqualified_t<T>, state> && !std::is_same_v<meta::unqualified_t<T>, state_view>)> {};
|
|| (std::is_array_v<
|
||||||
|
meta::unqualified_t<T>> || (!std::is_same_v<meta::unqualified_t<T>, state> && !std::is_same_v<meta::unqualified_t<T>, state_view>))> {
|
||||||
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline type type_of() {
|
inline type type_of() {
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// This file was generated with a script.
|
// This file was generated with a script.
|
||||||
// Generated 2020-05-07 02:16:42.603409 UTC
|
// Generated 2020-05-17 22:16:45.211397 UTC
|
||||||
// This header was generated with sol v3.2.0 (revision 890cdd3)
|
// This header was generated with sol v3.2.0 (revision 5022c4d)
|
||||||
// https://github.com/ThePhD/sol2
|
// https://github.com/ThePhD/sol2
|
||||||
|
|
||||||
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP
|
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP
|
||||||
|
@ -191,6 +191,10 @@
|
||||||
#define SOL_SAFE_STACK_CHECK 0
|
#define SOL_SAFE_STACK_CHECK 0
|
||||||
#endif // use luaL_checkstack to check stack overflow / overrun
|
#endif // use luaL_checkstack to check stack overflow / overrun
|
||||||
|
|
||||||
|
#if !defined(SOL_AUTOMAGICAL_TYPES_BY_DEFAULT)
|
||||||
|
#define SOL_AUTOMAGICAL_TYPES_BY_DEFAULT 1
|
||||||
|
#endif // make is_automagical on/off by default
|
||||||
|
|
||||||
// end of sol/config.hpp
|
// end of sol/config.hpp
|
||||||
|
|
||||||
// beginning of sol/config_setup.hpp
|
// beginning of sol/config_setup.hpp
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// This file was generated with a script.
|
// This file was generated with a script.
|
||||||
// Generated 2020-05-07 02:16:42.137643 UTC
|
// Generated 2020-05-17 22:16:42.038395 UTC
|
||||||
// This header was generated with sol v3.2.0 (revision 890cdd3)
|
// This header was generated with sol v3.2.0 (revision 5022c4d)
|
||||||
// https://github.com/ThePhD/sol2
|
// https://github.com/ThePhD/sol2
|
||||||
|
|
||||||
#ifndef SOL_SINGLE_INCLUDE_HPP
|
#ifndef SOL_SINGLE_INCLUDE_HPP
|
||||||
|
@ -217,6 +217,10 @@
|
||||||
#define SOL_SAFE_STACK_CHECK 0
|
#define SOL_SAFE_STACK_CHECK 0
|
||||||
#endif // use luaL_checkstack to check stack overflow / overrun
|
#endif // use luaL_checkstack to check stack overflow / overrun
|
||||||
|
|
||||||
|
#if !defined(SOL_AUTOMAGICAL_TYPES_BY_DEFAULT)
|
||||||
|
#define SOL_AUTOMAGICAL_TYPES_BY_DEFAULT 1
|
||||||
|
#endif // make is_automagical on/off by default
|
||||||
|
|
||||||
// end of sol/config.hpp
|
// end of sol/config.hpp
|
||||||
|
|
||||||
// beginning of sol/config_setup.hpp
|
// beginning of sol/config_setup.hpp
|
||||||
|
@ -7319,8 +7323,10 @@ namespace sol {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_automagical
|
struct is_automagical
|
||||||
: std::integral_constant<bool,
|
: std::integral_constant<bool,
|
||||||
std::is_array_v<
|
(SOL_AUTOMAGICAL_TYPES_BY_DEFAULT != 0)
|
||||||
meta::unqualified_t<T>> || (!std::is_same_v<meta::unqualified_t<T>, state> && !std::is_same_v<meta::unqualified_t<T>, state_view>)> {};
|
|| (std::is_array_v<
|
||||||
|
meta::unqualified_t<T>> || (!std::is_same_v<meta::unqualified_t<T>, state> && !std::is_same_v<meta::unqualified_t<T>, state_view>))> {
|
||||||
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline type type_of() {
|
inline type type_of() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user