Add working example of constructor overloading
This commit is contained in:
parent
abbb3b3818
commit
b8066a3f34
5 changed files with 118 additions and 10 deletions
|
@ -25,7 +25,7 @@
|
|||
|
||||
namespace wren {
|
||||
namespace detail {
|
||||
template <typename T, int... Indices, typename... Args>
|
||||
template <typename T, typename... Args, int... Indices>
|
||||
inline void construct_single (
|
||||
std::integer_sequence<int, Indices...>,
|
||||
VM& vm,
|
||||
|
@ -47,7 +47,7 @@ namespace wren {
|
|||
//number of types we invoke construct_single() with those types.
|
||||
constexpr int pack_size = static_cast<int>(sizeof...(PackArgs));
|
||||
if (pack_size == cardinality) {
|
||||
construct_single<T>(make_integer_sequence<int, pack_size>{}, vm, memory);
|
||||
construct_single<T, PackArgs...>(make_integer_sequence<int, pack_size>{}, vm, memory);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
@ -62,7 +62,7 @@ namespace wren {
|
|||
using std::make_integer_sequence;
|
||||
|
||||
if (1 == cardinality) {
|
||||
construct_single<T>(make_integer_sequence<int, 1>{}, vm, memory);
|
||||
construct_single<T, LoneArg>(make_integer_sequence<int, 1>{}, vm, memory);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -1,16 +1,20 @@
|
|||
include_files = [
|
||||
'callback_manager.hpp',
|
||||
'class_manager.hpp',
|
||||
'configuration.hpp',
|
||||
'def_configuration.hpp',
|
||||
'error_type.hpp',
|
||||
'guess_class_name.hpp',
|
||||
'handle.hpp',
|
||||
'has_method.hpp',
|
||||
'meson.build',
|
||||
'string_bt.hpp',
|
||||
'StringCRC32.hpp',
|
||||
'vm_fun.hpp',
|
||||
'vm.hpp',
|
||||
'wren_types.hpp',
|
||||
'detail/construct_foreign_class.hpp',
|
||||
'detail/error_type.hpp',
|
||||
'detail/guess_class_name.hpp',
|
||||
'detail/has_method.hpp',
|
||||
'detail/seters_getters.hpp',
|
||||
'detail/string_bt.hpp',
|
||||
'detail/StringCRC32.hpp',
|
||||
'detail/strings_in_vector.hpp',
|
||||
'detail/wren_types.hpp',
|
||||
]
|
||||
|
||||
if not meson.is_subproject()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue