|
Boost : |
From: etoffi_at_[hidden]
Date: 2000-12-25 09:52:42
Gregory Seidman writes:
> etoffi_at_[hidden] sez:
> }
> } Daryle Walker writes:
> }
> } ... snipped
> }
> } > namespace boost
> } > {
> } > class tcpipbuf
> } > : public std::streambuf
> } > , noncopyable
> } > {
> }
> } wouldnt this be a little better:
> [replace platform-specific pointer with template type]
>
> The benefit of the opaque pointer is that the actual implementation (and
> stored data), which is platform specific, need not be known by code using
> the interface class. The benefit of your suggestion is that an appropriate
> template parameter obviates the need for an extra heap allocation/deletion.
>
> The only downside of the opaque pointer is that a/d, whereas the downsides
> of your suggestion include (and I am probably not being complete) increased
> compile time (since any code using the interface must specialize the
> template for the given platform) and the need for a cross-platform
> interface to the no longer opaque internal data.
>
> Your suggestion is a general technique for avoiding extra a/d, but this is
> an optimization; we should all be familiar with the dangers of premature
> and/or unnecessary optimization. Unless a TCP/IP connection is being
> created and destroyed in a tight loop (not very likely since TCP
> connections tend to be used for some reasonable dialog, plus the connection
> setup time is likely to outweigh the a/d time anyway), this optimization
> merely exposes more code in the interface, thus creating more compile-time
> dependencies, without a noticeable performance gain.
>
> } --
> } etoffi
> --Greg
cant blame a girl for trying. *
but seriously, i was just under the impression that void* was a bad thing
to do (in _real_ c++), especially with a library like boost (smart_ptr
comes to mind). i do (kinda, sorta) see your point though.
* (sniggle. btw, i'm not a girl. its a joke.)
-- etoffi
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk