Re: C++ value from union structure using generic class



problem, it /is/ permitted to ignore the mantra, you know!
Yep think this is the way to go...cant try to do cute things to solve
problems


} That "<template data_type>" line is not C++ syntax, so I'm not sure
its a typo .. it should have been
template <data_type>
class Index {
int key; // id associated with union structure
}

*(reinterpret_cast<R*>(d_data.d_user_def_data)); I think you should be using a static_cast<R*> here, by the way.
I personally think of the C++ foo_casts as "the one with the shorter
name is more likely to be right".
static_cast > dynamic_cast > reinterpret_cast.
This is how i'm doing it presently
You need to read what the comp.lang.c FAQ has to say about unions,
and then read what the comp.lang.c++ FAQ says about templates. You're
coming up with really complicated anti-solutions to problems that
should be solved quickly and easily, either with the C-style
tag-and-union I showed you already, or with

template <typename T>
struct MyCache {
T *value;
};

// plus specializations for 'int' and 'float';
// compare "std::vector<bool>" in the C++ standard

-Arthur,
"when in doubt, read the FAQ"
Thanks for the suggestions

.



Relevant Pages

  • Re: My normal template keeps changing.
    ... If you are moving your customizations to a separate template (not ... That is a separate template in your Word Startup folder. ... See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome! ... This message is posted to a newsgroup. ...
    (microsoft.public.word.application.errors)
  • Re: Use Word template from Outlook
    ... See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome! ... This message is posted to a newsgroup. ... the macrobutton field is meant to ... new document in word based upon the template & double click the ...
    (microsoft.public.word.docmanagement)
  • Re: Use Word template from Outlook
    ... already knows (i.e. template, name address, date, auto prompts), and for me ... See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome! ... This message is posted to a newsgroup. ... the macrobutton field is meant to ...
    (microsoft.public.word.docmanagement)
  • Re: How do I stop templates from automatically starting?
    ... Every document has an attached template. ... Word New User FAQ & Web Directory: http://addbalance.com/word ... See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome! ... This message is posted to a newsgroup. ...
    (microsoft.public.word.docmanagement)
  • Re: About the WSS FAQ
    ... I've created a stripped down version of a site based on the FAQ template ... "Jim Duncan" wrote in message ... >>> The FAQ is two lists, one for the Sections and another for the FAQ's ...
    (microsoft.public.sharepoint.windowsservices)