Concatenating C++ iterator ranges into a const vector member variable at construction time

后端 未结 5 1361
情歌与酒
情歌与酒 2020-12-19 06:42

I have a class X, which I provide a snippet of here:

class X {
  public:
    template 
    X(Iter begin, Iter end) : mVec(begin, end) {}         


        
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-19 07:23

    It would probably be best to drop const (why would you insist on it anyway?).

    Otherwise, you have to build a concatenating iterator. It is quite a lot of code, see this thread for more.

提交回复
热议问题