We create a new online tool, computer number terms, you can use it to get the different expressions of disk usage, color value, and a few bases of numbers.

WASM For CPP – Bind std::vector<std::string>

To export std::vector<std::string> from C++ to JS, we can register vector for wasm.

    register_vector<std::string>("string_vector");

The returned object has interface get, we can use it to take value from container.

WASM For CPP – Bind Overrided Functon

// bind:
EMSCRIPTEN_BINDINGS(NumberTerms) {
   class_<NumberTerms>("NumberTerms")
      .constructor()
      .function("GetMemoryNumber_double_Type", select_overload<std::vector<std::string>(double, NumberTerms::MemoryType)>(&NumberTerms::GetMemoryNumber))
//...
}

// source:
class NumberTerms
{
    std::vector<std::string> GetMemoryNumber(double num, MemoryType mType);
    std::string GetMemoryNumber(double byte);
//...
}

Use it in html:

<script>
// ...

var result = worker.GetMemoryNumber_double_Type( parseFloat( $('memoryInput').value ), mType );

// ...
</script>
Categories: ToolWeb

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments

Content Summary
: Input your strings, the tool can get a brief summary of the content for you.

X
0
Would love your thoughts, please comment.x
()
x