By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,261 Members | 1,325 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,261 IT Pros & Developers. It's quick & easy.

C++ STLPort 5.0.2 ,new, vector

P: n/a
I got a problem with eVc4 i STLPort and i dont known why

c:\stlport-5.0.2\stlport\stl\_construct.h(115) : error C2665: 'new' :
none of
the 2 overloads can convert parameter 2 from type 'struct
ns::CPointT<short*'
c:\stlport-5.0.2\stlport\stl\_vector.h(351) : see reference to
function
template instantiation 'void __cdecl stlp_std::_Copy_Construct(struct
ns::CPointT<short*,const struct ns::CPointT<short&)' being compiled
#include <vector>
#include <algorithm>

template <class T>
struct CPointT {
T x;
T y;
CPointT(){};
CPointT( T p_x, T p_y) : x(p_x), y(p_y) {};
};

typedef CPointT<SHORTCPoint16;

std::vector<CPoint16punkty;
vector<CPoint16v1;
CPoint16 a(1,0);
v1.insert(v1.end(),a);

I dig into the STLPort and it fail on that
-----------------------------------------
#define _STLP_PLACEMENT_NEW new
...
template <class _Tp>
inline void _Copy_Construct(_Tp* __p, const _Tp& __val) {
_STLP_PLACEMENT_NEW (__p) _Tp(__val);
}

help
Nov 8 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Artur Bac wrote:
I got a problem with eVc4 i STLPort and i dont known why

c:\stlport-5.0.2\stlport\stl\_construct.h(115) : error C2665: 'new'
: none of
the 2 overloads can convert parameter 2 from type 'struct
ns::CPointT<short*'
c:\stlport-5.0.2\stlport\stl\_vector.h(351) : see reference to
function
template instantiation 'void __cdecl
stlp_std::_Copy_Construct(struct ns::CPointT<short*,const struct
ns::CPointT<short&)' being compiled

#include <vector>
#include <algorithm>

template <class T>
struct CPointT {
T x;
T y;
CPointT(){};
CPointT( T p_x, T p_y) : x(p_x), y(p_y) {};
};

typedef CPointT<SHORTCPoint16;

std::vector<CPoint16punkty;
vector<CPoint16v1;
CPoint16 a(1,0);
v1.insert(v1.end(),a);

I dig into the STLPort and it fail on that
-----------------------------------------
#define _STLP_PLACEMENT_NEW new
..
template <class _Tp>
inline void _Copy_Construct(_Tp* __p, const _Tp& __val) {
_STLP_PLACEMENT_NEW (__p) _Tp(__val);
}

help
You have written two constructors for CPointT, none of which is a copy
constructor. That means the struct cannot be copied.
Bo Persson

Nov 8 '06 #2

P: n/a
Bo Persson wrote:
Artur Bac wrote:
I got a problem with eVc4 i STLPort and i dont known why

c:\stlport-5.0.2\stlport\stl\_construct.h(115) : error C2665: 'new'
: none of
the 2 overloads can convert parameter 2 from type 'struct
ns::CPointT<short*'
c:\stlport-5.0.2\stlport\stl\_vector.h(351) : see reference to
function
template instantiation 'void __cdecl
stlp_std::_Copy_Construct(struct ns::CPointT<short*,const struct
ns::CPointT<short&)' being compiled

#include <vector>
#include <algorithm>

template <class T>
struct CPointT {
T x;
T y;
CPointT(){};
CPointT( T p_x, T p_y) : x(p_x), y(p_y) {};
};

typedef CPointT<SHORTCPoint16;

std::vector<CPoint16punkty;
vector<CPoint16v1;
CPoint16 a(1,0);
v1.insert(v1.end(),a);

I dig into the STLPort and it fail on that
-----------------------------------------
#define _STLP_PLACEMENT_NEW new
..
template <class _Tp>
inline void _Copy_Construct(_Tp* __p, const _Tp& __val) {
_STLP_PLACEMENT_NEW (__p) _Tp(__val);
}

help

You have written two constructors for CPointT, none of which is a copy
constructor. That means the struct cannot be copied.
No, the compiler should generate a copy constructor automatically. I
tried this code (replacing SHORT with short) on Comeau and Dinkumware's
tests, and it compiled fine. I'd guess it's a problem with STLport.

Cheers! --M

Nov 8 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.