|
Hello Friends
I am using vector and I used vector::iterator to iterate over the elements.
And after that I am using vector::reference = vector.back() to access last element.
Now,i want to assign all these refernce value to iterator one.
Any Ideas ?
Thanks & Regards
Yogesh
|
|
|
|
|
for (int i=1;i<vec.size();i++) vec[i] = vec[0];
?
|
|
|
|
|
You can't. The type of vector<T>::reference is T& , and has no reference to the original vector object, only to one element of type T .
The only way to assign an iterator is either through one of the methods of vector , or by assigning another iterator.
If you want an iterator to the last element, you can do this:
std::vector<int> myvector(5); std::vector::iterator last = myvector.end(); --last;
P.S.: after rereading your question I think I may have misinterpreted your question. If this isn't what you wanted and need more help, please clarify.
|
|
|
|
|
Thanks For your Answers.
I also proceed with the Stefan Method.
Thanks A Lot.
Regards
Yogesh
|
|
|
|
|
hi all,
i want to test comressed file or Archive in my MFC application.
i want its a valid zip file or not.
i have no idea from where i have to start.
please guide me and help me for this.
thanks in advance.
|
|
|
|
|
Use Google to find details on the different types of compressed files and their signatures.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
now how to open these files and decide these are valid archive or not.
|
|
|
|
|
I just explained what you need to do; what more information do you need?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
on signature basis i just found file is which type not that is valid or not.
so i want any class or function using the i can find the file is valid or not.
like test method in 7zip application.
|
|
|
|
|
Given the problem you are trying to resolve I would think you will have to write the function yourself. There are lots of resources on the internet concerned with compressed files that will help you.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
can provide any one out of this
thanks.
|
|
|
|
|
Le@rner wrote: i want its a valid zip file or not.
Are you using some sort of ZIP library or API?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
use the LiteZip and LiteUnZip article from code project.
LiteZip and LiteUnzip[^]
i am use its dll in my application.
|
|
|
|
|
So why not post your question to that article so the author will see it? Surely he has written some sort of "zip test" functionality to that library.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hello,
i googled a lot and and dont know what is the best way to messure the time that takes an execution of a function,is there some "stopwatch" in MFC?
Thanks
|
|
|
|
|
Just use QueryPerformanceCounterFrequency and QueryPerformanceCounter.
See here[^]
|
|
|
|
|
Hey,
Just to make sure i understood right
I query the count at the begining and at the end, then i devide it by the frequency and the result is the soconds?
Thanks
|
|
|
|
|
A thing to note: 'to measure' is the act of determining the value of a property. 'to mess (something up)' is somewhat synonym to 'meddle' or 'create chaos'. I'll assume that by 'messure' you mean the former, not the latter. 
|
|
|
|
|
To 'meddle' with the 'value of a property': messure
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
Hello,
I created owner drawn listbox and I used double buffering
for preventing flickering because I have a lot of data ,
the problem is that its don't present all the items and ,
whan I scroll it down and up its erases part of the items,
the code is:
void HistDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
if(IDC_LIST1 ==nIDCtl)
{
int width=lpDrawItemStruct->rcItem.right-lpDrawItemStruct->rcItem.left;
int height=lpDrawItemStruct->rcItem.bottom-lpDrawItemStruct->rcItem.top;
HDC memDC1 = CreateCompatibleDC(lpDrawItemStruct->hDC);
HBITMAP hMemBmp = CreateCompatibleBitmap(lpDrawItemStruct->hDC,width , height);
HBITMAP hOldBmp = (HBITMAP)SelectObject(memDC1, hMemBmp);
CDC *memDC=CDC::FromHandle(memDC1);
memDC->FillSolidRect(0,0, width, height,RGB(255,255,255));
int ODI_length =
1 + SendDlgItemMessage(IDC_LIST1,
LB_GETTEXTLEN,
lpDrawItemStruct->itemID,
0);
if (ODI_length)
{
wchar_t *ODI_wstr = NULL;
ODI_wstr = new wchar_t[ODI_length];
if (ODI_wstr)
{
COLORREF ODI_old_text_color;
SendDlgItemMessage(IDC_LIST1,
LB_GETTEXT,
lpDrawItemStruct->itemID,
(LPARAM)ODI_wstr);
memDC->DrawText(ODI_wstr,
ODI_length - 1,
&lpDrawItemStruct->rcItem,
DT_RIGHT);
}
}
BitBlt(lpDrawItemStruct->hDC, 0, 0, width,height, memDC1, 0, 0, SRCCOPY);
SelectObject(memDC1, hOldBmp);
DeleteObject(hMemBmp);
DeleteDC(memDC1);
}
}
What doe's I'm doing wrong?
thanks
|
|
|
|
|
aangerma wrote: BitBlt(lpDrawItemStruct->hDC, 0, 0, width,height, memDC1, 0, 0, SRCCOPY);
Shouldn't this be:
LONG left = lpDrawItemStruct->rcItem.left;
LONG top = lpDrawItemStruct->rcItem.top;
BitBlt(lpDrawItemStruct->hDC, left, top, width,height, memDC1, 0, 0, SRCCOPY);
?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hello,
I am writing an application that perform image acquisition frome a camera.
The image aqcuisition is done by a DLL Supplied by the camera manufactorer.
Basicaly im initializing the DLL and then i start capture,in my application i defened a function that is called by the DLL every captured frame,this "OnFrameCapturedHandler" function gets the frame as the parameter.
Then i perform some calculation on the frame and i display it on the GUI.
But the problem is that the grabbing is faster then my calculation so what happens is that a new frame comes in while the previous is still processed.So what i need is some way to block or to make "OnFrameCapturedHandler" not to do anything while previos frame is Processed.
I tried to put boolean at the begining of "OnFrameCapturedHandler" and set it to false while still processing and at the end set it to true.
And before entering the "OnFrameCapturedHandler" check it.but it freezes my app.
???
Thnaks.
|
|
|
|
|
I think the comments from Pete O'Hanlon in this thread[^] explain what is wrong and what you need to do.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
|
I just want to point out that if, as you say "the problem is that the grabbing is faster then my calculation" , then you are destined to lose frames. Threads and frame queues may help with the management of the arriving data but it is basic queueing, if your per-frame processing time exceeds the frame inter-arrival time, you will have problems. This basic tenet was masterfully demonstrated by the late Lucile Ball in the famous "chocolate candy factory" skit. Processing/interarrival mismatch[^]
Once you get the synchronization of the threads and queueing out of the way, you either need to make your processing faster or decide on how you choose which incoming frames to discard.
modified 13-Dec-11 10:46am.
|
|
|
|