Boost logo

Boost :

Subject: Re: [boost] 5 Observations - My experience with the boost libraries
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2010-03-28 20:17:54


Emil Dotchevski a écrit :
> There is nothing more encapsulating and
> more abstract than a basic C interface:
>
> struct foo;
> foo * create_foo( ..... );
> void frobnicate( foo * );
> void destroy_foo( foo * );
>
> For such interfaces, the most important thing is to physically
> decouple the user from implementation details. Templates and classes
> are useless for that.
>
> There are only two benefits of using C++ even for such C-style interfaces:
>
> 1) Use exceptions to report errors.
>
> 2) Use shared_ptr instead of relying on users to call destroy.

Or better yet, use destructors...


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk