Boost logo

Boost Users :

From: John Femiani (JOHN.FEMIANI_at_[hidden])
Date: 2008-07-08 16:18:36


 

> > Joshua Perry <josh <at> 6bit.com> writes:
> >> Now that I have the streams, I have a class that communicates with
> >> the device
> > and I would like to construct or initialize an object of that class
> > with any one of the streams. I have yet to figure out how
> to form the
> > constructor/function parameter to allow this.
> >>
> >> I've tried something like this, a stream of the base type of my
> >> devices:
> >> void init( stream< device<bidirectional> > str);
> >
> > Something like this?
<snip>
>
> Yes, and thats what I am doing now, but it only gives me
> access as a std::iostream. I would really like access to the
> other functionality of my templated class.
>

Have you considered a base class with templatized derived classes, like
boost::function? If that is what you are after I think it is called
'type erasure'.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net