Boost logo

Boost :

From: Dave Abrahams (abrahams_at_[hidden])
Date: 2000-01-06 05:37:16


> You are right, it was an unappropriate example ;) Indeed, if we would want
> to support some invariant (e.g. vertexes must be sorted in the clock-wise
> order) on an internal implementation of triangle (assuming what we would use
> 'point' class for this implementation), we would swap whole points, but not
> a separate coordinate values, as it happens with rectangle. But I think
> *there are* good examples for this issue.
>
> What are you think about following (potential) members of units_pair class:
>
> void swap_x( self& other ) { std::swap( x_, other.x_ ); }
> void swap_y( self& other ) { std::swap( y_, other.y_ ); }

Smells like overengineering to me. You don't need to account for fictional
cases you can't name yet.

-Dave


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