mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Fix unorded_map derp
This commit is contained in:
parent
48eea7b573
commit
48e5fc9e44
6
.github/ISSUE_TEMPLATE.md
vendored
6
.github/ISSUE_TEMPLATE.md
vendored
|
@ -1,4 +1,6 @@
|
|||
Read these guidelines. They are relatively simple and will allow me to help you better:
|
||||
Read these guidelines. They are relatively simple and will allow me to help you better!
|
||||
|
||||
For Error Reports:
|
||||
|
||||
1. Produce a simple, short, compilable test case that reproduces your problem.
|
||||
2. Make a descriptive title that summarises the bug as a whole.
|
||||
|
@ -11,4 +13,4 @@ If you want to request a feature:
|
|||
2. Include a description and title of what you would like.
|
||||
3. Annotate and describe the behavior through comments, asserts or just a small write up.
|
||||
|
||||
Thanks for helping sol grow!
|
||||
Thanks for helping sol2 grow!
|
||||
|
|
|
@ -213,8 +213,8 @@ if (SOL2_IS_TOP_LEVEL AND (SOL2_DO_TESTS OR SOL2_DO_EXAMPLES))
|
|||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
||||
else()
|
||||
string(REGEX REPLACE "/W[0-4]" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
|
||||
string(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
|
||||
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
if (BUILD_LUA_AS_DLL)
|
||||
string(REGEX REPLACE "/MT" "/MD" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
|
||||
string(REGEX REPLACE "/MT" "/MD" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
|
|
|
@ -12,6 +12,7 @@ After that, make sure you grab either the `single header file release`_, or just
|
|||
When you're ready, try compiling this short snippet:
|
||||
|
||||
.. literalinclude:: ../../../examples/source/tutorials/first_snippet.cpp
|
||||
:lines: 1-4, 8-
|
||||
:linenos:
|
||||
:caption: hello_lua.cpp
|
||||
:name: hello-lua
|
||||
|
@ -31,6 +32,7 @@ If this works, you're ready to start! The first line creates the ``lua_State`` a
|
|||
The second line opens a single lua-provided library, "base". There are several other libraries that come with lua that you can open by default, and those are included in the :ref:`sol::lib<lib-enum>` enumeration. You can open multiple base libraries by specifying multiple ``sol::lib`` arguments:
|
||||
|
||||
.. literalinclude:: ../../../examples/source/tutorials/open_multiple_libraries.cpp
|
||||
:lines: 1-4, 8-
|
||||
:linenos:
|
||||
:caption: multiple_libraries.cpp
|
||||
:name: open-multiple-libraries
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <sol/sol.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <unordered_map>
|
||||
#include "assert.hpp"
|
||||
|
||||
// use as-is,
|
||||
|
@ -39,12 +40,12 @@ int main() {
|
|||
lua.open_libraries(sol::lib::base);
|
||||
|
||||
lua.new_usertype<dynamic_object>("dynamic_object",
|
||||
sol::meta_function::index, &dynamic_object::dynamic_get,
|
||||
sol::meta_function::new_index, &dynamic_object::dynamic_set,
|
||||
sol::meta_function::length, [](dynamic_object& d) {
|
||||
return d.entries.size();
|
||||
}
|
||||
);
|
||||
sol::meta_function::index,
|
||||
&dynamic_object::dynamic_get,
|
||||
sol::meta_function::new_index,
|
||||
&dynamic_object::dynamic_set,
|
||||
sol::meta_function::length,
|
||||
[](dynamic_object& d) { return d.entries.size(); });
|
||||
|
||||
lua.safe_script(R"(
|
||||
d1 = dynamic_object.new()
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <sol/sol.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <unordered_map>
|
||||
|
||||
struct thing {
|
||||
int member_variable = 5;
|
||||
|
@ -21,11 +22,11 @@ static std::unordered_map<sol::string_view, sol::object> thing_variable_associat
|
|||
|
||||
void register_thing_type(sol::state& lua) {
|
||||
thing_variable_associations.emplace_hint(thing_variable_associations.cend(),
|
||||
"member_variable", sol::object(lua.lua_state(), sol::in_place, &sol::c_call<TEMPLATE_AUTO(&thing::member_variable)>)
|
||||
);
|
||||
"member_variable",
|
||||
sol::object(lua.lua_state(), sol::in_place, &sol::c_call<TEMPLATE_AUTO(&thing::member_variable)>));
|
||||
thing_function_associations.emplace_hint(thing_function_associations.cend(),
|
||||
"member_function", sol::object(lua.lua_state(), sol::in_place, &sol::c_call<TEMPLATE_AUTO(&thing::member_function)>)
|
||||
);
|
||||
"member_function",
|
||||
sol::object(lua.lua_state(), sol::in_place, &sol::c_call<TEMPLATE_AUTO(&thing::member_function)>));
|
||||
|
||||
struct call_handler {
|
||||
static int lookup_function(lua_State* L) {
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
#include <sol/sol.hpp> // or #include "sol.hpp", whichever suits your needs
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
// silence unused warnings
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
sol::state lua;
|
||||
lua.open_libraries(sol::lib::base);
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
#include <sol/sol.hpp>
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
|
||||
// silence unused warnings
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
sol::state lua;
|
||||
lua.open_libraries(sol::lib::base, sol::lib::coroutine, sol::lib::string, sol::lib::io);
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <sol/stack.hpp>
|
||||
#include <sol/usertype_container.hpp>
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
namespace sol {
|
||||
|
||||
namespace container_detail {
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <sol/make_reference.hpp>
|
||||
|
||||
#include <bitset>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace sol { namespace u_detail {
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// This file was generated with a script.
|
||||
// Generated 2020-09-26 13:38:14.149661 UTC
|
||||
// This header was generated with sol v3.2.1 (revision 1fb483d)
|
||||
// Generated 2020-10-03 21:34:25.034794 UTC
|
||||
// This header was generated with sol v3.2.1 (revision 48eea7b5)
|
||||
// https://github.com/ThePhD/sol2
|
||||
|
||||
#ifndef SOL_SINGLE_CONFIG_HPP
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// This file was generated with a script.
|
||||
// Generated 2020-09-26 13:38:14.123663 UTC
|
||||
// This header was generated with sol v3.2.1 (revision 1fb483d)
|
||||
// Generated 2020-10-03 21:34:25.022965 UTC
|
||||
// This header was generated with sol v3.2.1 (revision 48eea7b5)
|
||||
// https://github.com/ThePhD/sol2
|
||||
|
||||
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// This file was generated with a script.
|
||||
// Generated 2020-09-26 13:38:13.096661 UTC
|
||||
// This header was generated with sol v3.2.1 (revision 1fb483d)
|
||||
// Generated 2020-10-03 21:34:24.496436 UTC
|
||||
// This header was generated with sol v3.2.1 (revision 48eea7b5)
|
||||
// https://github.com/ThePhD/sol2
|
||||
|
||||
#ifndef SOL_SINGLE_INCLUDE_HPP
|
||||
|
@ -21137,6 +21137,8 @@ namespace sol {
|
|||
|
||||
// end of sol/usertype_container.hpp
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
namespace sol {
|
||||
|
||||
namespace container_detail {
|
||||
|
@ -21709,6 +21711,7 @@ namespace sol {
|
|||
// beginning of sol/usertype_storage.hpp
|
||||
|
||||
#include <bitset>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace sol { namespace u_detail {
|
||||
|
||||
|
|
|
@ -34,34 +34,6 @@ function(CREATE_TEST test_target_name test_name target_sol)
|
|||
target_link_libraries(${test_target_name}
|
||||
PUBLIC Threads::Threads ${LUA_LIBRARIES} ${target_sol})
|
||||
|
||||
if (MSVC)
|
||||
if (NOT CMAKE_COMPILER_ID MATCHES "Clang")
|
||||
target_compile_options(${test_target_name}
|
||||
PRIVATE /bigobj /W4)
|
||||
endif()
|
||||
else()
|
||||
target_compile_options(${test_target_name}
|
||||
PRIVATE -std=c++1z -pthread
|
||||
-Wno-unknown-warning -Wno-unknown-warning-option
|
||||
-Wall -Wpedantic -Werror -pedantic -pedantic-errors
|
||||
-Wno-noexcept-type)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
# For another day, when C++ is not so crap
|
||||
# and we have time to audit the entire lib
|
||||
# for all uses of `detail::swallow`...
|
||||
#target_compile_options(${test_target_name}
|
||||
# PRIVATE -Wcomma)
|
||||
endif()
|
||||
|
||||
if (IS_X86)
|
||||
if(MINGW)
|
||||
set_target_properties(${test_target_name}
|
||||
PROPERTIES
|
||||
LINK_FLAGS -static-libstdc++)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if (MSVC)
|
||||
target_compile_options(${test_target_name}
|
||||
PRIVATE /EHsc /std:c++latest)
|
||||
|
|
Loading…
Reference in New Issue
Block a user