473,385 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

vector declaration?

Hi
with:

dataStart = dbt.item[j].start;

i get that error:

src/Database/DBDatabase.cpp:272: error: request for member 'start' in
'((CDatabase*)this)->CDatabase::dbt.CDatabaseTemplate::item.
std::vector<_Tp, _Alloc>::operator[] [with _Tp = CDatabaseTemplateItem*,
_Alloc = std::allocator<CDatabaseTemplateItem*>](((long unsigned
int)j))', which is of non-class type 'CDatabaseTemplateItem*'

class CDatabaseTemplate {

//protected:
std::vector<CDatabaseTemplateItem* item; ///< Vector of template
items
actually i have start like that:

class CDatabaseTemplateItem {

public:
int start, end;

Why do i get an error? How should i declare/define start?
Thanks
Michael
Jul 18 '06 #1
1 2569
Michael Sgier <sg***@nospam.chwrote:
dataStart = dbt.item[j].start;

i get that error:

src/Database/DBDatabase.cpp:272: error: request for member 'start' in
'((CDatabase*)this)->CDatabase::dbt.CDatabaseTemplate::item.
std::vector<_Tp, _Alloc>::operator[] [with _Tp =
CDatabaseTemplateItem*, _Alloc =
std::allocator<CDatabaseTemplateItem*>](((long unsigned int)j))',
which is of non-class type 'CDatabaseTemplateItem*'

class CDatabaseTemplate {

//protected:
std::vector<CDatabaseTemplateItem* item; ///< Vector of template
items
class CDatabaseTemplateItem {

public:
int start, end;
Change

dataStart = dbt.item[j].start;

to

dataStart = dbt.item[j]->start;

Your vector is holding pointers. 'dbt.item[i]' return an element of
the vector, which is a pointer type, which is why you have to
dereference it.

hth
--
jb

(reply address in rot13, unscramble first)
Jul 18 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Honestmath | last post by:
Hi, I added the following line to my code within a class declaration: std::vector<Date> m_duedates(100); I also tried: std::vector<Date> m_duedates(100, Date());
4
by: John | last post by:
I have a function declaration that gives an error while compiling. Can anyone help me figure this one out? inline void create(const std::vector< myclass >& plist, std::vector< myclass...
2
by: Lovens Weche | last post by:
I'm trying to compile this code with VC++ 7: class KeyboardInterface { public: .....
14
by: Michael Sgier | last post by:
Hello If someone could explain the code below to me would be great. // return angle between two vectors const float inline Angle(const CVector& normal) const { return acosf(*this % normal); }...
3
by: Daniel J Watkins | last post by:
Hi, Some runtime memory exceptions are being exhibited with some code I've written. Can you clarify the following with you to see if my understanding of the principles under question are...
3
by: gamehack | last post by:
Hi all, Here's the error which I'm getting when trying to compile some code: boxmanager.h:16: error: ISO C++ forbids declaration of 'vector' with no type boxmanager.h:16: error: expected...
12
by: y-man | last post by:
Hi, I am creating a child class of the vector, which contains a couple of functions to make the work with carthesian coordinate vectors easier. To make things work more easily, I would like to...
4
by: kungfuelmosan | last post by:
Hey guys, Im just getting into c++ at the moment so please bare with me Basically i need to declare a vector<stringstringArray(50) inside a class, however by doing so i am getting the following...
5
by: subramanian100in | last post by:
I am copying the following text as it is from Stroustrup's TC++PL 3rd edition, page 450. It says: "Note that a constructor given two arguments of the same type can be a match for more than...
6
by: samsneelam | last post by:
Hi.. This is samuel, while doing a program, i encountered this problem.. Let me give you clarity regarding my prob.. I am having two files .. one is mpcplib.h it contains the follwing...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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...

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.