Inclusion argument order sorting

This commit is contained in:
ThePhD 2016-04-23 17:40:22 -04:00
parent fdefa46ddc
commit 2497567897
9 changed files with 111 additions and 111 deletions

View File

@ -25,6 +25,9 @@
#include "sol/state.hpp"
#include "sol/object.hpp"
#include "sol/function.hpp"
#include "sol/protected_function.hpp"
#include "sol/state.hpp"
#include "sol/coroutine.hpp"
#include "sol/variadic_args.hpp"
#endif // SOL_HPP

View File

@ -39,11 +39,11 @@ inline std::string get_type_name(const std::type_info& id) {
std::string realname = id.name();
const static std::array<std::string, 2> removals = { { "struct ", "class " } };
for (std::size_t r = 0; r < removals.size(); ++r) {
auto found = realname.find(removals[r]);
while (found != std::string::npos) {
realname.erase(found, removals[r].size());
found = realname.find(removals[r]);
}
auto found = realname.find(removals[r]);
while (found != std::string::npos) {
realname.erase(found, removals[r].size());
found = realname.find(removals[r]);
}
}
return realname;
}
@ -143,8 +143,8 @@ inline std::string demangle() {
template <typename T>
inline std::string short_demangle() {
static const std::string d = short_demangle_once<T>();
return d;
static const std::string d = short_demangle_once<T>();
return d;
}
} // detail
} // sol

View File

@ -24,7 +24,6 @@
#include "reference.hpp"
#include "stack.hpp"
#include "resolve.hpp"
#include "function_result.hpp"
#include "function_types.hpp"
#include <cstdint>

View File

@ -25,7 +25,6 @@
#include "reference.hpp"
#include "tuple.hpp"
#include "stack.hpp"
#include "stack_proxy.hpp"
#include "proxy_base.hpp"
#include <cstdint>
@ -76,14 +75,6 @@ public:
lua_pop(L, returncount);
}
};
template <>
struct bond_size<function_result> : std::integral_constant<std::size_t, SIZE_MAX> {};
template <std::size_t I>
stack_proxy get(const function_result& fr) {
return stack_proxy(fr.lua_state(), static_cast<int>(fr.stack_index() + I));
}
} // sol
#endif // SOL_FUNCTION_RESULT_HPP

View File

@ -26,7 +26,6 @@
#include "tuple.hpp"
#include "stack.hpp"
#include "proxy_base.hpp"
#include "stack_proxy.hpp"
#include <cstdint>
namespace sol {
@ -126,14 +125,6 @@ public:
stack::remove(L, index, popcount);
}
};
template <>
struct bond_size<protected_function_result> : std::integral_constant<std::size_t, SIZE_MAX> {};
template <std::size_t I>
stack_proxy get(const protected_function_result& fr) {
return stack_proxy(fr.lua_state(), static_cast<int>(fr.stack_index() + I));
}
} // sol
#endif // SOL_FUNCTION_RESULT_HPP

View File

@ -24,7 +24,6 @@
#include "stack_core.hpp"
#include "stack_reference.hpp"
#include "stack_proxy.hpp"
#include "stack_check.hpp"
#include "stack_get.hpp"
#include "stack_check_get.hpp"

View File

@ -23,6 +23,8 @@
#define SOL_STACK_PROXY_HPP
#include "stack.hpp"
#include "function.hpp"
#include "protected_function.hpp"
#include "proxy_base.hpp"
namespace sol {
@ -74,6 +76,22 @@ struct pusher<stack_proxy> {
}
};
} // stack
template <>
struct bond_size<function_result> : std::integral_constant<std::size_t, SIZE_MAX> {};
template <std::size_t I>
stack_proxy get(const function_result& fr) {
return stack_proxy(fr.lua_state(), static_cast<int>(fr.stack_index() + I));
}
template <>
struct bond_size<protected_function_result> : std::integral_constant<std::size_t, SIZE_MAX> {};
template <std::size_t I>
stack_proxy get(const protected_function_result& fr) {
return stack_proxy(fr.lua_state(), static_cast<int>(fr.stack_index() + I));
}
} // sol
#endif // SOL_STACK_PROXY_HPP

View File

@ -24,7 +24,6 @@
#include "error.hpp"
#include "table.hpp"
#include "stack_proxy.hpp"
#include <memory>
namespace sol {
@ -129,12 +128,12 @@ public:
luaL_requiref(L, "debug", luaopen_debug, 1);
lua_pop(L, 1);
break;
case lib::ffi:
case lib::ffi:
#ifdef SOL_LUAJIT
luaL_requiref(L, "ffi", luaopen_ffi, 1);
#endif
break;
case lib::jit:
case lib::jit:
#ifdef SOL_LUAJIT
luaL_requiref(L, "jit", luaopen_jit, 1);
#endif
@ -160,7 +159,7 @@ public:
stack_proxy load(const std::string& code) {
luaL_loadstring(L, code.c_str());
return stack_proxy(L, -1);
return stack_proxy(L, -1);
}
stack_proxy load_file(const std::string& filename) {

View File

@ -28,105 +28,105 @@
#include <iterator>
namespace sol {
struct va_iterator : std::iterator<std::random_access_iterator_tag, stack_proxy, std::ptrdiff_t, stack_proxy*, stack_proxy> {
lua_State* L;
int index;
int stacktop;
stack_proxy sp;
struct va_iterator : std::iterator<std::random_access_iterator_tag, stack_proxy, std::ptrdiff_t, stack_proxy*, stack_proxy> {
lua_State* L;
int index;
int stacktop;
stack_proxy sp;
va_iterator() : L(nullptr), index(std::numeric_limits<int>::max()), stacktop(std::numeric_limits<int>::max()) {}
va_iterator(lua_State* L, int index, int stacktop) : L(L), index(index), stacktop(stacktop), sp(L, index) {}
va_iterator() : L(nullptr), index(std::numeric_limits<int>::max()), stacktop(std::numeric_limits<int>::max()) {}
va_iterator(lua_State* L, int index, int stacktop) : L(L), index(index), stacktop(stacktop), sp(L, index) {}
stack_proxy operator*() {
sp = stack_proxy(L, index);
return sp;
}
stack_proxy operator*() {
sp = stack_proxy(L, index);
return sp;
}
stack_proxy* operator->() {
sp = stack_proxy(L, index);
return &sp;
}
stack_proxy* operator->() {
sp = stack_proxy(L, index);
return &sp;
}
va_iterator& operator++ () {
++index;
return *this;
}
va_iterator& operator++ () {
++index;
return *this;
}
va_iterator operator++ (int) {
auto r = *this;
this->operator ++();
return r;
}
va_iterator operator++ (int) {
auto r = *this;
this->operator ++();
return r;
}
va_iterator& operator-- () {
--index;
return *this;
}
va_iterator& operator-- () {
--index;
return *this;
}
va_iterator operator-- (int) {
auto r = *this;
this->operator --();
return r;
}
va_iterator operator-- (int) {
auto r = *this;
this->operator --();
return r;
}
va_iterator& operator+= (difference_type idx) {
index += static_cast<int>(idx);
return *this;
}
va_iterator& operator+= (difference_type idx) {
index += static_cast<int>(idx);
return *this;
}
va_iterator& operator-= (difference_type idx) {
index -= static_cast<int>(idx);
return *this;
}
va_iterator& operator-= (difference_type idx) {
index -= static_cast<int>(idx);
return *this;
}
difference_type operator- (const va_iterator& r) const {
return index - r.index;
}
difference_type operator- (const va_iterator& r) const {
return index - r.index;
}
va_iterator operator+ (difference_type idx) const {
va_iterator r = *this;
r += idx;
return r;
}
va_iterator operator+ (difference_type idx) const {
va_iterator r = *this;
r += idx;
return r;
}
stack_proxy operator[](difference_type idx) {
return stack_proxy(L, index + static_cast<int>(idx));
}
stack_proxy operator[](difference_type idx) {
return stack_proxy(L, index + static_cast<int>(idx));
}
bool operator==(const va_iterator& r) const {
if (stacktop == std::numeric_limits<int>::max()) {
return r.index == r.stacktop;
}
else if (r.stacktop == std::numeric_limits<int>::max()) {
return index == stacktop;
}
return index == r.index;
}
bool operator==(const va_iterator& r) const {
if (stacktop == std::numeric_limits<int>::max()) {
return r.index == r.stacktop;
}
else if (r.stacktop == std::numeric_limits<int>::max()) {
return index == stacktop;
}
return index == r.index;
}
bool operator != (const va_iterator& r) const {
return !(this->operator==(r));
}
bool operator != (const va_iterator& r) const {
return !(this->operator==(r));
}
bool operator < (const va_iterator& r) const {
return index < r.index;
}
bool operator < (const va_iterator& r) const {
return index < r.index;
}
bool operator > (const va_iterator& r) const {
return index > r.index;
}
bool operator > (const va_iterator& r) const {
return index > r.index;
}
bool operator <= (const va_iterator& r) const {
return index <= r.index;
}
bool operator <= (const va_iterator& r) const {
return index <= r.index;
}
bool operator >= (const va_iterator& r) const {
return index >= r.index;
}
};
bool operator >= (const va_iterator& r) const {
return index >= r.index;
}
};
inline va_iterator operator+(typename va_iterator::difference_type n, const va_iterator& r) {
return r + n;
}
inline va_iterator operator+(typename va_iterator::difference_type n, const va_iterator& r) {
return r + n;
}
struct variadic_args {
private: