M
miaohua1982
the program is as follows:
#include <vector>
using namespace std;
class A{};
int main()
{
A* const &p = NULL;
vector<A*> B(3,NULL); //there is a compile error
B.push_back(NULL);
return 0;
}
int VC7£¬the error is
d:\Microsoft Visual Studio .NET 2003\Vc7\include\vector(357): error
C2664: "std::vector<_Ty>::_Construct_n" : can't convert from "int"
to "A *const & "
with
[
_Ty=A *
]
which puzzles me is that , why this one"A* const &p = NULL;" is OK,
the compiler even doesn't give a warning?!
#include <vector>
using namespace std;
class A{};
int main()
{
A* const &p = NULL;
vector<A*> B(3,NULL); //there is a compile error
B.push_back(NULL);
return 0;
}
int VC7£¬the error is
d:\Microsoft Visual Studio .NET 2003\Vc7\include\vector(357): error
C2664: "std::vector<_Ty>::_Construct_n" : can't convert from "int"
to "A *const & "
with
[
_Ty=A *
]
which puzzles me is that , why this one"A* const &p = NULL;" is OK,
the compiler even doesn't give a warning?!