suppose I have an abstract interface class Interface { virtual void foo = 0 } and classes class A public Interface

bad_alloc. If you don't want it to throw, I guess it returns 0.

Errrrrrr.

all containers let it pass through if new throws bad_alloc
just pay attention to the exception guarantee of the various member functions you call upon those containers

ok

so you know if the contents are left in order or not

What alexs_ said… ever heard of manpages?

I seem to remember more than one chapter on the standard library from TC++PL though

I have no idea what the exception guarantees are, I've gone to the SGI webpage but it doesn't seem to document them

yes ofc. the original question to me it sounded like the user had to chose between the 2 books as the unique source of information
in that case I couldnt decide on one. I needed both

No it sounds like he has to choose between 2 books to start his collection of C++ books.

I don't think manpages or references can replace a book on the standard library

there are general exception guarantees for all containers except some special member functions
ok, you are e better mindreader then me then
the Force is strong with you

Where might I find these guarantees, d1zzy?

in the standard

Which standard?
the C++98 standard or the STL standard?

"the STL standard"?

!stl

ok, that answers my question

AFAIK there is only one ISO C++ standard
and in the darknes binds them all

I got a vector of pointers to a base class. Based on what is the derived type I need to do something. Is there some way to avoid dynamic_cast?

The 98 one or the 03 one?

virtual methods

yes, use virtual member functions
that's why you have pointers to base classes in the first place
it's the same standard number, only some fixes have been made in 2003
so referring to the same standard number we mean including all the fixes

something alike getType() which returns the type?

that beats the purpose
why do you have pointers to base in the first place?
so you have pointers to base and now you will do switch/case on if whatevertype, that sounds like a very stupid idea
you have pointers to base because at runtime different objects implementing the same interface may be referenced by the container

he don't shoot me, I'm correcting someone else's code

make the interface do something different for each type

i just need to past some kind of list of "analysises" to a function, and that function calls some method on each analysis in turn for each event it receives from an input file

!method

all analysis inherit from the base "Analysis", but they obviously do something else

The term `method' is not well-defined in C++. Did you mean to imply a function that is a member? Or one that is non-static? Or one that is virtual? Or one that is pure? To avoid misunderstandings, prefer standardized terminology: instead of `method' say `function' prefixed with those specifiers
that are relevant to your question.

so call on the member virtual function from that function
each derived has it's own implementation of the member
so they do different things
that's the basic of runtime polymorphism…

yes, that's what it does now, but now I i have this problem: "If there exists a LinearAnalysis in the list, then I need to call some function specific to the BasicAnalysis". That's why I thought I had to iterate over them all and use dynamic_cast
using virtual members would solve that of course

so use them

hi there did someone read the book C++ template metaprogramming (Gurtovoy)

avoid casts

ok

started to read
will drop it for now until I finnish C++ templates. complete guide
and modern c++ design

wow ok…

hmm wow?

I'm stuck on chapter 9 crossing the compile-time/runtime boundary
but wait, perhaps someone knows the boost

 PHP 5 Web Hosting | PHP 5 Hosting

*
To prove that you're not a bot, enter this code
Anti-Spam Image

Leave a Comment

You must be logged in to post a comment.


Blog Tags:

Similar posts: