Trying to load a vector, I got the following messages:
10 1886
d:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algobase.h:247: error: no match for 'operator*' in '*__result'
d:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algobase.h:249: error: no match for 'operator++' in '++__result'
Here is the WindDataReceiveBuffer header:
- #ifndef WINDDATARECEIVEBUFFER_H_
-
#define WINDDATARECEIVEBUFFER_H_
-
-
#include "windsTableElement.h"
-
#include <vector>
-
typedef std::vector< WindsTableElement > WindTable;
-
WindTable wt_;
-
-
class WindDataReceiveBuffer
-
{
-
-
static WindDataReceiveBuffer* instance_;
-
-
protected:
-
WindDataReceiveBuffer();
-
~WindDataReceiveBuffer();
-
WindDataReceiveBuffer(const WindDataReceiveBuffer&);
-
WindDataReceiveBuffer& operator=(const WindDataReceiveBuffer&);
-
-
public:
-
static WindDataReceiveBuffer* Instance();
-
void setData(char*, unsigned int);
-
WindTable getWindTable();
-
-
};
-
-
#endif /*WINDDATARECEIVEBUFFER_H_*/
-
And the implementation code: - #include <iostream>
-
#include "WindDataReceiveBuffer.h"
-
-
WindDataReceiveBuffer* WindDataReceiveBuffer::instance_ = 0;
-
-
WindDataReceiveBuffer* WindDataReceiveBuffer::Instance()
-
{
-
if (instance_ == 0)
-
{
-
instance_ = new WindDataReceiveBuffer;
-
}
-
return instance_;
-
}
-
- WindDataReceiveBuffer::WindDataReceiveBuffer()
-
{
-
-
}
-
-
WindDataReceiveBuffer::~WindDataReceiveBuffer()
-
{
-
}
-
-
void WindDataReceiveBuffer::setData(char* inBufr,
-
unsigned int size)
-
{
-
std::copy(inBufr, inBufr+(size * sizeof(WindsTableElement)), wt_);
-
}
-
-
WindTable WindDataReceiveBuffer::getWindTable()
-
{
-
return wt_;
-
}
-
And the implementation code: - #include <iostream>
-
#include "WindDataReceiveBuffer.h"
-
-
WindDataReceiveBuffer* WindDataReceiveBuffer::instance_ = 0;
-
-
WindDataReceiveBuffer* WindDataReceiveBuffer::Instance()
-
{
-
if (instance_ == 0)
-
{
-
instance_ = new WindDataReceiveBuffer;
-
}
-
return instance_;
-
}
-
When you define instance_ for the first time (your first line of code here), don't include the WindDataReceiveBuffer* before the WindDataRetrieveBuffer::instance_ declaration. Including this makes it seem like a function which would be returning a variable of type WindDataReceiveBuffer*, which works for your Instance() function, but not a static variable declaration.
It seems I need to overload the operators ++ and * for the pointer __result.
Can you help?
(Sorry for using so many posts, but it is the only way I could get all the code in.
Refer to the "Incrementing a pointer" thread for the windsTableElement class code.)
the third argument to std::copy must be an output iterator, not an object. So, you can use a pointer, or an actual iterator class, etc. Refer to the std::copy documentation for more info.
When you define instance_ for the first time (your first line of code here), don't include the WindDataReceiveBuffer* before the WindDataRetrieveBuffer::instance_ declaration. Including this makes it seem like a function which would be returning a variable of type WindDataReceiveBuffer*, which works for your Instance() function, but not a static variable declaration.
The static member variable instance_ contains a pointer to an instantiation of WindDataReceiveBuffer, making sure using routines can only construct one of them.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Carsten Spieß |
last post by:
Hello all,
i have a problem with a template constructor
I reduced my code to the following (compiled with gcc 2.7.2) to show
my problem:
// a base class
class Base{};
// two derived...
|
by: John N. |
last post by:
Hi All,
Here I have a linked list each containing a char and is double linked.
Then I have a pointer to an item in that list which is the current
insertion point.
In this funtion, the user...
|
by: Mike D. |
last post by:
I have a problem with a dynamic library I am developing, but it is
really more of a pointer issue than anything else. Hopefully someone
here can lend me some assistance or insight into resolving...
|
by: Kieran Simkin |
last post by:
Hi,
I wonder if anyone can help me, I've been headscratching for a few hours
over this.
Basically, I've defined a struct called cache_object:
struct cache_object {
char hostname;
char ipaddr;...
|
by: Alexei A. Frounze |
last post by:
Hi all,
I have a question regarding the gcc behavior (gcc version 3.3.4).
On the following test program it emits a warning:
#include <stdio.h>
int aInt2 = {0,1,2,4,9,16};
int aInt3 =...
|
by: Marcelo |
last post by:
Hi everybody,
I don't understand why I am having a problem in this code.
The problem is that my pointer *phist in main method, it is declared.
Then I send the pointer to my method, and this...
|
by: Joe Van Dyk |
last post by:
When you delete a pointer, you should set it to NULL, right?
Joe
|
by: toton |
last post by:
Hi,
This is continuation of topic pointer & reference doubt.
http://groups.google.com/group/comp.lang.c++/browse_thread/thread/df84ce6b9af561f9/76304d7d77f6ccca?lnk=raot#76304d7d77f6ccca
But I...
|
by: junky_fellow |
last post by:
Hi,
To print the pointer using printf(), we convert it to (void *) .
printf("%p",(void *)ptr);
My question is how printf() determine which type of pointer is passed
to it and
prints its value...
|
by: worlman385 |
last post by:
For pointer and non-pointer initialization of an object like
MyCar mycar;
MyCar* mycar = new MyCar();
I heard from other people saying if object i create must live outside
scape, then I use...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |