Skip to content

Commit 326703c

Browse files
authored
[Doc] embind.rst - remove "Optional" arg from register_optional (#22687)
Calling `register_optional<std::string>("Optional");` results in: ``` error: no matching function for call to 'register_optional' 8 | emscripten::register_optional<std::string>("Optional"); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /path/to/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/bind.h:1880:6: note: candidate function template not viable: requires 0 arguments, but 1 was provided 1880 | void register_optional() { | ^ 1 error generated ``` As shown in later in the doc and in usage in #21076, `register_optional` should not take in an argument. Also see the source code: https://github.com/emscripten-core/emscripten/blob/df2200953b57af106dc8a597692580b796f542ef/system/include/emscripten/bind.h#L2006
1 parent a2debca commit 326703c

File tree

1 file changed

+1
-1
lines changed
  • site/source/docs/porting/connecting_cpp_and_javascript

1 file changed

+1
-1
lines changed

site/source/docs/porting/connecting_cpp_and_javascript/embind.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ For convenience, *embind* provides factory functions to register
10781078
EMSCRIPTEN_BINDINGS(stl_wrappers) {
10791079
register_vector<int>("VectorInt");
10801080
register_map<int,int>("MapIntInt");
1081-
register_optional<std::string>("Optional");
1081+
register_optional<std::string>();
10821082
}
10831083
10841084
A full example is shown below:

0 commit comments

Comments
 (0)