|
I don't think it's possible. boost/type_traits has such facilities, but the case you're looking for requires partial template specialization (hey, if the Boost guys weren't able to make it in VS.NET chances are it is damn hard). If you can get by with info about whether a given type is a pointer or not, this can be done in VS.NET (if you're interested I can send you some code detached from Boost for easier comsumption).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
hey, if the Boost guys weren't able to make it in VS.NET chances are it is damn hard
True!
Joaquín M López Muñoz wrote:
If you can get by with info about whether a given type is a pointer or not, this can be done in VS.NET
For my particular problem that won't help me much anyway.
My problem is basically this:
template <typename T>
struct deleter {
void operator()(T* pObj) const { delete pObj; }
};
typedef std::vector<AClass*> AClassVector;
AClassVector vec;
vec.push_back(...);
...
std::for_each(vec.begin(), vec.end(), deleter<AClassVector::value_type>()); This doesn't work well since my deleter template works on a different level of abstraction. operator()(T* pObj) becomes operator()(AClass** pObj) which delete won't handle. So, I basically wanted to do this:
std::for_each(vec.begin(), vec.end(), deleter<deref<AClassVector::value_type> >()); I know I can pass AClass as template parameter to deleter<> (which I did later ). But I think deref<AClassVector::value_type> would have been a more elegant solution.
--
There's a new game we like to play you see. A game with added reality. You treat me like a dog, get me down on my knees.
We call it master and servant.
|
|
|
|
|
Can anyone explain me what I have to do with this error?
0xC0000005:Acces Violation
The debugger stops at:
//perform specific initializations
if (!pThread->InitInstance())
{
if(pThread->m_pMainWnd !=NULL)
{ TRACE0("Warning: Destroying non-NULL m_pMainWnd\n");
pThread->m_pMainWnd->DestroyWindow();
}
nReturnCode=pThread->ExitInstance();
goto InitFailure;
}
nReturnCode = pThread ->Run();
The debugger stops at the line; pThread->m_pMainWnd->DestroyWindow();
Thanx,
kind regards,
Geert
|
|
|
|
|
put a breakpoint before the line and see what it is returning..and what u were expecting..so you will know why it is happening.. I guess you are doing it wrong way..so it doesn't know anything such as window to be destroyed..try m_pmainWnd->destroywindow(); i hope this will work..;)
cheers..
Himanshu
|
|
|
|
|
Just a quick stab in the dark, but the fact that your
UI Thread failed to initialised :
pThread->InitInstance() // returns false
.. would indicate that the handle to the thread's main window,
pThread->m_pMainWnd, may not have been initialised.
This would explain the memory violation when attempting to do
pThread->m_pMainWnd->DestroyWindow(); .
The fact that m_pMainWnd is not NULL is not an indication that it is a valid handle.
..
...
<shockhorror>
and my golly god, did I see a goto statement at the end of your code?
|
|
|
|
|
Or you have not waited until it HAS initialised
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
damn, thats a bold 'goto' statement. to hell with efficiency, long live 'goto' lol! !
todo....
:: insert inpirational text here ::
|
|
|
|
|
Mail having attachment type "octet-stream"? and encoding base64. how to decode this?
thanks in advance
Murali
|
|
|
|
|
An octet is a byte. An "octet-stream" mime type is just an unspecified binary file, which could be a .EXE, an MP3, a ZIP, or anything you may want.
A base64 encoded text can be decoded by a base64 decoder.
Sorry, I know the last explanation sucks, but base64 is a very simple encoding and there are lots of encoders/decoders freely available on the web, and, IIRC, even on CP.
The .NET framework also has a base64 decoder included, so if you are doing MC++ this would be easy too.
I see dumb people
|
|
|
|
|
What is cross posting ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Christian Graus wrote:
What is cross posting ?
It's the second most common break of netiquette rules on CP. The first is programming questions on The Lounge.
I see dumb people
|
|
|
|
|
Hi,
can I create a button which not get focus if it is clicked? (a focusless button like a button in a toolbar)
The focus should stay with the current control and not be "stolen" by button click. Possibly it can be done by overriding WM_LBUTTONDOWN ...? It would be great if I can avoid ownerdraw (to keep XP style button, if code is running on XP). What I found on Google mentions it has to be a onwerdraw button rebuild from scratch.
At the moment I simply set the focus back after button is clicked, but that's not that great.
Thx for help, Moak
|
|
|
|
|
For example:
CButton* bt = (CButton*)GetDlgItem(IDC_BUTTON1);
void XDlg::OnButton1()
{
bt->EnableWindow(FALSE);//For Focusless
}
void XDlg::OnRbuttonDown()
{
bt->EnableWindow(TRUE);//For back to Focus;
}
Is this helpful to you.
|
|
|
|
|
yaiii... amazing that this really works. nice trick, chepuri_uk!
I changed the code a bit and use something like this now:
void CButtonFL::OnLButtonDown(UINT nFlags, CPoint point)
{
EnableWindow(FALSE);
CButton::OnLButtonDown(nFlags, point);
EnableWindow(TRUE);
}
Gratefully, Moak
PS: I own you a pizza
|
|
|
|
|
i can't undesrtand...what is it you want..in a toolbar too we have focus on the buttons..when we click them..you can just disable it..and use if you want like that..
cheers
Himanshu
|
|
|
|
|
yeah like a button on a PC... like when you click and all the focus was gone... huuu.... like a button but just like without this focus... like when you click and... it then does not take focus... like in a toolbar we have. It's kind of button.
Moak
--
"...and it was like, bleep bleep bleep bleep
bleep bleep bleep..." Ellen Feiss, Student
|
|
|
|
|
|
hi,
do it like this!!!!!!!!!!!!!!
Open the header file for your view (double-click the class name in Class View), this is CDisableToolbarView in the example.
Okay; we need to write the declarations for our three functions; these would be as so:
afx_msg void OnToolbarButtonClick();
That's all we need in our header, so we can close that and open our cpp file.
For each of the three functions declared above, we need to create a function defintition like the one below.
void CToolbarView::OnToolbarButtonClick()
{
MessageBox("Red clicked");
}
Toward the top of the cpp file you will see a block of code starting with BEGIN_MESSAGE_MAP. Within these lines we can hook the click events up to our functions. Between the BEGIN_MESSAGE_MAP and END_MESSAGE_MAP lines, add the following three lines:
ON_BN_CLICKED(ID_TBRED,OnToolbarButtonClick)
thats it..
cheers
Himanshu
|
|
|
|
|
You may also try the easy solution :
Add your button in the ressource editor.
Doubleclick on it to open properties.
Give it a name (for instance ID_OPENFILE).
Close the window, go open the class wizard.
Select your button name in the list on the right and handle the corresponding message. All the stuff given by Himanshu will be added automatically.
Oh, BTW, Himanshu, feel free to put your code into a <pre> environment, it is far more readable.
~RaGE();
|
|
|
|
|
Hi, everyone!
Please look at the following code,
--------
#if ASSERT
sprintf (s, "_Assert: %s, %d",__FILE__, __LINE__ );
#else
//...
#endif
--------
I want to know where is the precompiled directive ASSERT defined?
Is it compiler system defined variable? What is the meaning and
function of it?
Thanks in advance,
George
|
|
|
|
|
Never heard of it. There is the _ASSERT() macro.. but i guess this ASSERT must have been defined somewhere else in your code, since obviously the one who wrote the code tried to run his own Debug Tracer.
~RaGE();
|
|
|
|
|
Thanks, Rage pal!
I am not agree with you. I think I can use "ASSERT (a>0);"
directly in MFC(without #define ASSERT before), so I think the
precompiled directive ASSERT is defined somewhere in the
compiling system and not in my app. But I am not sure about it.
Maybe ASSERT is defined only in MFC and it is not C++ stardard.
I am not sure.
What is your opinion?
Cheers,
George
|
|
|
|
|
Yup, you're right. I tried
#ifdef ASSERT
g
#endif
and it raised a compilation error (in a MFC project of mine). Sorry.
George2 wrote:
Maybe ASSERT is defined only in MFC and it is not C++ stardard
For sure. Assertion are not C++ standard. check out <assert.h>
BTW, where are you from ? I mean, originally (know your current location are US, but George seems to me like a french name)
~RaGE();
|
|
|
|
|
Thanks, Rage pal!
I am from Mars. My uncle is Martin.
I have another question, where can I find the
table of all the C++ standard compiler predefined
directive and their related meaning, like __LINE__?
Thanks in advance,
George
|
|
|
|
|
George2 wrote:
I am from Mars. My uncle is Martin.
George2 wrote:
I have another question, where can I find the
table of all the C++ standard compiler predefined
directive and their related meaning, like __LINE__?
Check out the MSDN (online on www.msdn.microsoft.com[^])
i.e. make a search of __LINE__ for macros or simply #pragma or #ifdef for directives. I can't link you the right page, since i have no internet access but a few sites (like CP) . I could copy and paste it here, but that's not really interesting since my local MSDN is in german
~RaGE();
|
|
|
|