Weird compiler error: Cannot convert parameter from 'int' to 'int &&'

前端 未结 4 1523
忘了有多久
忘了有多久 2020-12-09 04:14

What on earth is going on here?
I\'m trying to create a pair of an int and a string and I can create the pair if I use \"magic values\" but can

4条回答
  •  爱一瞬间的悲伤
    2020-12-09 04:48

    Now std::make_pair is defined the following way in the C++ Standard

    template 
    

    see below make_pair(**T1&&, T2&&**);

    You could write simpler without using std::make_pair

    num_text.push_back( { 42, text } ); .

提交回复
热议问题