|
Classes from "Boost" looks promising. Thanks for the information.
BTW, just for academic interest, can you look into the example I have given in the initial post? I just want to make sure auto_ptr can be used in such a way.
|
|
|
|
|
yes, i think your examples are correct. since the problem with auto_ptr, in this situation, is that passing an auto_ptr to a function makes a copy, and the copy takes control of the allocated memory. passing it by reference (either as a ref or as a ptr) avoids that copy, and the outer function maintains control of the memory.
|
|
|
|
|
Many thanks
|
|
|
|
|
FYI: Visual C++ 2008 SP1+ has a shared_ptr Class[^] as well.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark. But unfortunatly I can't use it as my application is portable across multiple platforms. I believe the one which you said is not portable (please correct me if I am wrong). Your help is much appreciated though.
|
|
|
|
|
Christian Flutcher wrote: portable across multiple platforms
In that case Boost is a better option for the time being if you need shared_ptr.
shared_ptr will currently only be found on compilers that have implemented the
TR1[^] extensions.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi all,
I have made a dialog based application and in that i have put some buttons, now the problem is i am putting bmp on dialog using picture control and then bmp's on my button control. my pictrue control is hiding my buttons but when i press alt alt my buttons become visible....
how can i remove this problem...
thanks in advance
|
|
|
|
|
What you're saying isn't clear.
Is the picture control so large that it is covering the buttons?
Are the buttons visible in design mode?
|
|
|
|
|
buttons are visible in design
|
|
|
|
|
You didn't answer the other question. Is the picture control so large that it is physically covering the buttons?
|
|
|
|
|
VCProgrammer wrote: how can i remove this problem..
What problem?
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]
|
|
|
|
|
Hi,
your message is not very clear. My best guess is your PictureBox is autosizing, i.e.
it is growing according to the size of the picture you are showing, and in doing so it
is covering up some Controls it did not cover while designing.
One solution is to disable the autosizing, and possibly choose image stretching instead,
so the image is scaled to fit your picturebox (warning: this does not preserve the aspect ratio).
I don't know the details in C++/MFC.
|
|
|
|
|
Luc Pattyn wrote: I don't know the details in C++/MFC.
u gimme codez sir, no wordz, plz plz sir.
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]
|
|
|
|
|
Since you didn't mention urgent nor homework, and being in a good mood, I will assume you
are a professional, and have the stamina to create your own codez.
You could prove me wrong at any time though...
|
|
|
|
|
Hi all,
when i Build or Rebuild my application it takes so much time.
before some time its not takes so much time.i dont know now why it takes so much time for build the application.
i want to speed up the build process.
is its possible.
please tell me .
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
1) Check whether the incremental Linking is enabled in the project settings. It can slow down each time when you rebuild the application. Try turning off the incremental link. This thread[^] is interesting.
2) Check whether the latest visual studio service pack is installed.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
In addition to the things mentioned by Jijo Raj, try configuring your projects to use Precompiled Headers.
|
|
|
|
|
|
I've never seen one, but you can always try Google.
|
|
|
|
|
you'll have to use a library (like Gecko[^], for example)
|
|
|
|
|
I have a class called curves and an stl::list of them called curveList.
class curve {
int getValue();
.
.
.
} ;
typedef std::list<curve>::iterator curveItr;
class curveList
{
public:
curveItr getCurveByID(ID i);
.
private:
std::list<curve> _myList
.
}
in my code, I declare
curveItr iter;
iter = myCurveList.getCurveByID(1); // this returns the correct iterator
I get the right value back. Now I want to use iter to call a function of curve to return a value (I'm trying to avoid casting as pointers, list of pointers, etc). Everything I do throws a LINK error LNK2019 unresolved external. I have tried
iter->getValue();
*iter.getValue();
&(*iter)->getValue();
p = static_cast<curve *>(iter)
but everything throws back the same error. Is there a correct way to do this or do i have to resort to lists of pointers?
BTW, the curve/type declarations are in a separate file from getCurveByID is called.
|
|
|
|
|
mjackson11 wrote: Everything I do throws a LINK error LNK2019 unresolved external.
If it is a linker error, then it means that the code compiles fine. Besides, your first approach is the correct one (iter->getValue() ). The error specifies that you have decleared a function but you didn't provide any definition for it. I guess it is for the getValue function, am I right ?
To fix the problem, simply provide a function body.
|
|
|
|
|
Stupid programming tricks -- the method was defined in a file that was in the directory but not included in the project.
Two wasted days.
|
|
|
|
|
I have a long running program (written in C++ using MFC) that consists of one thread to handle the GUI interface and one or more worker threads to do the actual computation / simulation. The worker threads are simulating a stochastic process over and over again. When the worker thread completes one simulation, it notifies the GUI thread by reporting either a pass or fail. This notification is done by calling a member function in the GUI object.
The user interface displays the data entered by the user and every time a run is completed, I would like the user interface to be updated. However, I only want the single line that has changed. The line that has changed looks like:
Passed: <number> Failed: <number>
Currently, the member function that handles the reporting in the GUI object calls the routine CWnd::Invalidate(). This results in (my version of) OnPaint being called. This results in the entire screen being redrawn. Since, I am getting about 10 updates per seond, the screen appears to flicker. I only want to update the single line that has changed. If that line appears to flicker it is ok. What is the best way to do this?
Thanks
Bob
|
|
|
|
|
Hi,
IMO you should only invalidate that portion of the window that needs repainting, have a look
at CWnd::InvalidateRect
That will restrict the region that gets erased, and the information will also be passed to the
paint handler. For optimal performance and minimal flicker, make sure your OnPaint
only repaints the region it is told to repaint.
|
|
|
|