Author Topic: 调用了_stack.emplace_back()没有参数,是怎么回事?  (Read 4161 times)

0 Members and 1 Guest are viewing this topic.

Offline xiabchina

  • Newbie
  • *
  • Posts: 6
    • View Profile
Q 群里回答你了。

查 deque 类的文档 http://en.cppreference.com/w/cpp/container/deque/emplace_back

template< class... Args >
void emplace_back( Args&&... args );

... 表示可变数量参数,数量可以是 0 ,这种情况下,会调用 Args 类的缺省初始化构造函数来创建一个对象。
@abit,thanks,q群里我也看到,这块还是不太懂,我要再看下,再和你讨论

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 4664
    • View Profile
    • Abit's Hive Blog
  • BitShares: abit
  • GitHub: abitmore
Q 群里回答你了。

查 deque 类的文档 http://en.cppreference.com/w/cpp/container/deque/emplace_back

template< class... Args >
void emplace_back( Args&&... args );

... 表示可变数量参数,数量可以是 0 ,这种情况下,会调用 Args 类的缺省初始化构造函数来创建一个对象。
BitShares committee member: abit
BitShares witness: in.abit

Offline xiabchina

  • Newbie
  • *
  • Posts: 6
    • View Profile
想咨询大家一个问题,在undo_database.hpp中定义了std::deque<undo_state>  _stack;在start_undo_session()调用了_stack.emplace_back();问题是.emplace_back没有参数,但是确实_stack中写进东西了,什么回事?