Non-static const member, can't use default assignment operator

后端 未结 4 1655
北海茫月
北海茫月 2020-11-27 04:45

A program I\'m expanding uses std::pair<> a lot.

There is a point in my code at which the compiler throws a rather large:

N

4条回答
  •  北荒
    北荒 (楼主)
    2020-11-27 05:43

    As far as I can tell, someplace you have something like:

    // for ease of reading 
    typedef std::pair, const double*> MyPair;
    
    MyPair myPair = MAKEPAIR(.....);
    myPair.first = .....;
    

    Since the members of MyPair are const, you can't assign to them.

提交回复
热议问题