diff options
author | Todd Lee <tlee@imvu.com> | 2013-01-31 18:31:56 -0800 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2013-04-12 14:23:50 +0300 |
commit | 4fa56f796784b44a2b70aa69c5c9de012634ecd4 (patch) | |
tree | 5da1b0e4c71e62dad03b2888fcce3b9f572a1a5d /system | |
parent | 62b9f6a00f0eee036e7dfb4326a813c31d3ba41e (diff) |
move vecFromJSArray from bind.h to val.h to make it unnecessary to include bind.h
Diffstat (limited to 'system')
-rwxr-xr-x | system/include/emscripten/bind.h | 12 | ||||
-rw-r--r-- | system/include/emscripten/val.h | 13 |
2 files changed, 13 insertions, 12 deletions
diff --git a/system/include/emscripten/bind.h b/system/include/emscripten/bind.h index 99b29e9c..7a87107f 100755 --- a/system/include/emscripten/bind.h +++ b/system/include/emscripten/bind.h @@ -729,18 +729,6 @@ namespace emscripten { // VECTORS //////////////////////////////////////////////////////////////////////////////// template<typename T> - std::vector<T> vecFromJSArray(val v) { - auto l = v["length"].as<unsigned>(); - - std::vector<T> rv; - for(unsigned i = 0; i < l; ++i) { - rv.push_back(v[i].as<T>()); - } - - return rv; - }; - - template<typename T> class_<std::vector<T>> register_vector(const char* name) { using namespace std; typedef vector<T> VecType; diff --git a/system/include/emscripten/val.h b/system/include/emscripten/val.h index 857a1bdf..3952e008 100644 --- a/system/include/emscripten/val.h +++ b/system/include/emscripten/val.h @@ -2,6 +2,7 @@ #include <stdint.h> // uintptr_t #include <emscripten/wire.h> +#include <vector> namespace emscripten { namespace internal { @@ -237,4 +238,16 @@ namespace emscripten { } }; } + + template<typename T> + std::vector<T> vecFromJSArray(val v) { + auto l = v["length"].as<unsigned>(); + + std::vector<T> rv; + for(unsigned i = 0; i < l; ++i) { + rv.push_back(v[i].as<T>()); + } + + return rv; + }; } |