Boost logo

Boost :

From: Gregory Seidman (gseidman_at_[hidden])
Date: 2000-12-25 08:56:45

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

Boost list run by bdawes at, gregod at, cpdaniel at, john at