M
Markus Dehmann
I am trying to make a pair with a string and an auto_ptr:
#include <iostream>
#include <map>
using namespace std;
int main(){
auto_ptr<int> p(new int(3));
make_pair("x",p);
}
But it won't compile:
stl_pair.h:85: error: passing `const std::auto_ptr<int>' as `t\
his' argument of `std::auto_ptr<_Tp>:perator
std::auto_ptr_ref<_Tp1>() [with _Tp1 = int, _Tp = int]' discards
qualifiers
I didn't make p const, so I don't understand why it complains ... How
can I make it work?
#include <iostream>
#include <map>
using namespace std;
int main(){
auto_ptr<int> p(new int(3));
make_pair("x",p);
}
But it won't compile:
stl_pair.h:85: error: passing `const std::auto_ptr<int>' as `t\
his' argument of `std::auto_ptr<_Tp>:perator
std::auto_ptr_ref<_Tp1>() [with _Tp1 = int, _Tp = int]' discards
qualifiers
I didn't make p const, so I don't understand why it complains ... How
can I make it work?