|
Thanks for replying.
The assertion isn't in my code as such it's in line 238 of the vector header file:
#if _HAS_ITERATOR_DEBUGGING
void _Compat(const _Myt& _Right) const
{
if (this->_Mycont == 0 || this->_Mycont != _Right._Mycont)
{
_DEBUG_ERROR("vector iterators incompatible");
_SCL_SECURE_INVALID_ARGUMENT;
}
}
#endif /* _HAS_ITERATOR_DEBUGGING */
I assume I could somehow disable iterator debugging to get around this error, but I would like to know why I'm getting the error in the first place. Am I doing something wrong? The iterators both come from the same vector object, so how could they be incompatible?
Phil
|
|
|
|
|
In a class or struct declaration in Visual C++ 2008, for example
class BMPheader{public: char BM[2]; long size; short u,v; long imagestart;};
or
struct BMPheader{char BM[2]; long size; short u,v; long imagestart;};
can I trust on that being an accurate description of the resulting byte pattern inside the computer, to match the format of a binary file that is read in? My experience here is:
Gnu C++ for DOS: no, because after each element was inserted 0 or 1 or 2 or 3 unused bytes, to get each byte to start at an address which was a multiple of 4, unless I inserted a special keyword to tell the compiler to pack the elements close.
Borland C++ 4.5 for Windows: yes.
|
|
|
|
|
You have not to worry about alignment, as far you are consistent on writing to and reading from file, for instance (error handling left to the reader)
struct BMPHeader bmphout;
...
FILE * fpout = fopen("foo.bin", "wb");
fwrite( &bmphout, sizeof(bmphout),1, fpout);
fclose(fpout);
and then
struct BMPHeader bmphin;
FILE * fpin = fopen("foo.bin", "rb");
fread( &bmphin, sizeof(bmphin),1, fpin);
fclose(fpin);
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
But here I am reading from a file format which someone else (probably at Microsoft many years ago) invented. So I need to know how to make Visual C++ 2008 compile a struct or class with the elements in the same order as declared with no extra bytes inserted between.
|
|
|
|
|
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Anthony Appleyard wrote: But here I am reading from a file format which someone else (probably at Microsoft many years ago) invented.
Why are you not using the Microsoft structure definitions
that have been around just as long?
BITMAPFILEHEADER is packed with 2-byte alignment
BITMAPINFO and BITMAPINFOHEADER are packed with 1-byte alignment.
To see how that affects struct padding and alignment, see
align (C++)[^]
/Zp (Struct Member Alignment)[^]
etc...
If you're going to redefine these structs and expect them to match
everyone else, then you'll probably want to set your structure packing
the same as Microsoft's (see #pragma pack).
*edit* Also, using platform-specific types like "long" and "short" is a bad<br />
idea if you expect to match the Microsoft definitions.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
modified on Thursday, December 20, 2007 7:40:28 PM
|
|
|
|
|
Like DPtoLP, how to do it with GDI+,
use TransformPoints?
|
|
|
|
|
Yes, it looks promising.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
i has need code for windoz service when starting os.plz send politly.
|
|
|
|
|
|
Thank you for link sir. I search web also.
|
|
|
|
|
|
oh hai!
would you like cheezeburger insted?
|
|
|
|
|
Iz can have cheeseburger?
|
|
|
|
|
No, Iz (mini Izzy?) cannot have a cheeseburger. This is not the food forum.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
plzz chzzzburger!!!!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Is this good for windows service?
|
|
|
|
|
Is good service anyway, with or without nearby windows
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Yeah .
|
|
|
|
|
Doesn't windoz have an 'e' at the end?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Not the one that sells fiz filet samchez.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
|
As a wizard, you should be able to conjure this up using your How to be a Wizard in 21 Days book that came in your Welcome Package when you joined the Wizard club.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi.
I am not sure how to explain this but I want to declare a member in a base class. IN a class derived from this, I want to be able to be able to override the member with another class that is derived from that original member.
Ex:
class CBase
{
virtual CTest m_test;
}
class CBase1 : public CBase
{
virtual CTest1 m_test;
}
CTest1 is derived from CTest.
I want to be able to almost use the same name in each class and just add more fuunctionality in the CBase1 class, but CBase will still be able to call fuctions from m_test. Then in CBase1, it can call additional functions available in CTest1... This is like a virtual function but I want to do it for a member variable or something.
I am not sure if I explained it right. Anyone can give me an idea?
Thanks.
Stan the man
|
|
|
|