473,513 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

STL Vector of class

2 New Member
Hi,
My program has a class and has a vector as the member. This is vector of the class itself. But during compilation it throws error that class is undefined and cannot be used. Below is my code snippet:

class xInterface {
private :
std::vector<xInterface> bInstance;

public:
xInterface () {};
xInterface (int x, int y)
{
/* my code ...*/
}

~xInterface() { };
}

C:\Documents and Settings\Disc\DesktopRAW\include\stlport\stl/type_traits.h(249) : error C2139: 'xInterface' : an undefined class is not allowed as an argument to compiler intrinsic type trait '__has_trivial_constructor'
c:\documents and settings\Disc\desktop\MyProject\include\xinstance. h(12) : see declaration of 'xInterface'
C:\Documents and Settings\Disc\Desktop\RAW\include\stlport\stl/_vector.h(137) : see reference to class template instantiation 'stlp_std::__type_traits<_Tp>' being compiled
with
[
_Tp=xInterface
]

Any pointers to resolve this?
Aug 8 '07 #1
2 1701
JosAH
11,448 Recognized Expert MVP
Hi,
My program has a class and has a vector as the member. This is vector of the class itself.
Just think what would happen if such an object stores *itself* in its own vector.
Better make that a vector of references or pointers to that class instead.

kind regards,

Jos
Aug 8 '07 #2
Disc B
2 New Member
Hi Jos,
Thanks for the reply. I had the similar implementation when I used VC++ libraries(VS 2005). But when I use this STL library alone this specific error is thrown. Even in linux platform, STL is used and it deosnt throw error.

Regards
Disc B
Aug 9 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
5899
by: Alan Benn | last post by:
(VC6) When I use the STL <vector> template as follows: #include <vector> .... vector<CString> m_nameList; // Names of the chips I get these compiler warnings : C:\Program...
11
6282
by: sw | last post by:
Hi, Is it possible to insert a class <vec> which has a vector<double> member, into the vector<vec> veclist for e.g? I've been getting compilation errors when trying to insert using the vector...
9
5859
by: uotani.arisa | last post by:
Hi, Can someone tell me how to declare a pointer to a vector of pointers? I'm just not sure how to do this... I've tried essentially the following: vector<string *> * v; ....
9
8882
by: aaragon | last post by:
I am trying to create a vector of type T and everything goes fine until I try to iterate over it. For some reason, the compiler gives me an error when I declare std::vector<T>::iterator iter;...
24
2917
by: toton | last post by:
Hi, I want to have a vector like class with some additional functionality (cosmetic one). So can I inherit a vector class to add the addition function like, CorresVector : public...
12
2162
by: mast2as | last post by:
Hi everyone I am working on some code that uses colors. Until recently this code used colors represented a tree floats (RGB format) but recently changed so colors are now defined as spectrum....
1
3058
by: krunalbauskar | last post by:
Hi, Explicit instantiation of STL vector demands explicit instantiation of all the templates it using internally. For example - <snippet> #include <iostream> #include <vector>
6
3976
by: Jia | last post by:
Hi all, I have a class foo which has a static vector of pointers of type base class, and a static function to set this vector. #include <iostream> #include <vector> using namespace std;...
4
3026
by: helge | last post by:
What is the best way to implement a vector in space R3, i.e a vector holding three floats, supporting arithmetic operations, dot and cross product etc in c++? is there a standard library class for...
3
1670
by: Ramon F Herrera | last post by:
Newbie alert: I come from C programming, so I still have that frame of mind, but I am trying to "Think in C++". In C this problem would be solved using unions. Hello: Please consider the...
0
7391
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7553
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7120
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5697
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3235
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1609
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
466
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.