diff --git a/docs/source/api/usertype_memory.rst b/docs/source/api/usertype_memory.rst index dc639617..55734f7e 100644 --- a/docs/source/api/usertype_memory.rst +++ b/docs/source/api/usertype_memory.rst @@ -12,7 +12,7 @@ In general, we always insert a T* in the first `sizeof(T*)` bytes, so the any fr For ``T`` --------- -These are classified with the metatable from `` +These are classified with the metatable name from :ref:`usertype_traits\`. The data layout for references is as follows:: @@ -44,4 +44,4 @@ The data layout for these kinds of types is as follows:: | T* | void(*)(void*) function_pointer | T | ^-sizeof(T*) bytes-^-sizeof(void(*)(void*)) bytes, deleter-^- sizeof(T) bytes, actal data -^ -Note that we put a special deleter function before the actual data. This is because the custom deleter must know where the offset to the data is, not the rest of the library. Sol just needs to know about ``T*`` and the userdata (and userdata metatable) to work, everything else is for preserving construction / destruction syntax. \ No newline at end of file +Note that we put a special deleter function before the actual data. This is because the custom deleter must know where the offset to the data is, not the rest of the library. Sol just needs to know about ``T*`` and the userdata (and userdata metatable) to work, everything else is for preserving construction / destruction semantics. \ No newline at end of file diff --git a/docs/source/rtti.rst b/docs/source/rtti.rst index 58c9d3de..91aad3e9 100644 --- a/docs/source/rtti.rst +++ b/docs/source/rtti.rst @@ -3,6 +3,10 @@ run-time type information (rtti) because somebody's going to want to shut this off, too... --------------------------------------------------------- +Sol does not use RTTI anymore. + +*THE BELOW IS NO LONGER NEEDED.* + Not compiling with C++'s run-time type information? Do a ``#define SOL_NO_RTII`` before you include ``sol.hpp`` or define ``SOL_NO_RTTI`` on your command line. Be sure to understand the :ref:`implications` of doing so if you also turn off exceptions. If you come across bugs or can't compile because there's a stray `typeid` or `typeinfo` that wasn't hidden behind a ``#ifndef SOL_NO_RTTI``, please file `an issue`_ or even make a pull request so it can be fixed for everyone. diff --git a/docs/source/safety.rst b/docs/source/safety.rst index 382b3bbb..8e01113f 100644 --- a/docs/source/safety.rst +++ b/docs/source/safety.rst @@ -6,12 +6,12 @@ Sol was designed to be correct and fast, and in the pursuit of both uses the reg Note that you can obtain safety with regards to functions you bind by using the :doc:`protect` wrapper around function/variable bindings you set into Lua. ``SOL_SAFE_USERTYPE`` triggers the following change: - * If the userdata to a usertype function is nill, will trigger an error instead of letting things go through and letting the system segfault + * If the userdata to a usertype function is nil, will trigger an error instead of letting things go through and letting the system segfault. ``SOL_CHECK_ARGUMENTS`` triggers the following changes: * ``sol::stack::get`` (used everywhere) defaults to using ``sol::stack::check_get`` and dereferencing the argument. It uses ``sol::type_panic`` as the handler if something goes wrong. * ``sol::stack::call`` and its variants will, if no templated boolean is specified, check all of the arguments for a function call. - * If ``SOL_SAFE_USERTYPE`` is not defined, it gets defined to turn it on + * If ``SOL_SAFE_USERTYPE`` is not defined, it gets defined to turn being on. Remember that if you want these features, you must explicitly turn them on. Additionally, you can have basic boolean checks when using the API by just converting to a :doc:`sol::optional\` when necessary. Tests are compiled with this on to ensure everythign is going as expected. diff --git a/sol/demangle.hpp b/sol/demangle.hpp index c9936916..90ee42ac 100644 --- a/sol/demangle.hpp +++ b/sol/demangle.hpp @@ -62,11 +62,11 @@ namespace sol { return name; } #elif defined(__GNUC__) || defined(__clang__) - template + template inline std::string ctti_get_type_name() { const static std::array removals = { { "{anonymous}", "(anonymous namespace)" } }; - std::string name = __PRETTY_FUNCTION__; - std::size_t start = name.find_last_of('['); + std::string name = __PRETTY_FUNCTION__; + std::size_t start = name.find_first_of('['); start = name.find_first_of('=', start); std::size_t end = name.find_last_of(']'); if (end == std::string::npos) @@ -76,21 +76,21 @@ namespace sol { if (start < name.size() - 1) start += 1; name = name.substr(start, end - start); - start = name.find(";"); + start = name.rfind("seperator_mark"); if (start != std::string::npos) { - name.erase(start, name.length()); + name.erase(start - 2, name.length()); } while (!name.empty() && std::isblank(name.front())) name.erase(name.begin()); while (!name.empty() && std::isblank(name.back())) name.pop_back(); - for (std::size_t r = 0; r < removals.size(); ++r) { - auto found = name.find(removals[r]); + for (std::size_t r = 0; r < removals.size(); ++r) { + auto found = name.find(removals[r]); while (found != std::string::npos) { name.erase(found, removals[r].size()); found = name.find(removals[r]); } } - + return name; } #else