当函数接受std :: vector时,为什么我会得到一个“大括号括起来的初始化列表”

时间:2017-02-12 03:36:21

标签: c++ c++11

我遇到了c ++(c ++ 11)

的问题

此代码:

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [/usr/local/bin/node]
 2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/usr/local/bin/node]
 3: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/usr/local/bin/node]
 4: v8::internal::Factory::NewRawOneByteString(int, v8::internal::PretenureFlag) [/usr/local/bin/node]
 5: v8::internal::Factory::NumberToString(v8::internal::Handle<v8::internal::Object>, bool) [/usr/local/bin/node]
 6: v8::internal::Runtime_NumberToStringSkipCache(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
 7: 0x18caa0a079a7
 8: 0x18caa0f37cbc
 Abort trap: 6

失败了:

void execute(std::vector<boost::variant<int, std::string>> params){
   printf("There are %d parameters\n", params.size());
}

execute( { 21, "test", 98 } );

0 个答案:

没有答案