|
Boost : |
From: jsiek_at_[hidden]
Date: 1999-12-10 12:42:02
I wrote up the mayfly pattern for PLoP'99. Here's the paper if anyone
is interested:
http://www.lsc.nd.edu/~jsiek/mayfly_plop99.pdf
scleary_at_[hidden] writes:
> Just a word on mayfly objects in general: the design pattern of mayfly
> objects is very powerful; they allow advanced and easier-to-use requirements
> to be satisfied in a run-time- and memory- efficient manner. For example,
> if you look at the original GGCL specs, a "ContainerRef" is basically a
> mayfly container (that doesn't own its objects); this could allow, for a
> vertex "v": "v.in_edges()" to return a ContainerRef of edges going into this
> vertex, "v.out_edges()" to return a ContainerRef of edges leaving this
> vertex, and "v.edges()" to return a ContainerRef of edges incident on this
> vertex, but each of these functions taking constant time. Conceptually,
> [v.in_edges() + v.out_edges()] == v.edges(). However, ContainerRef objects
> usually consist of one or two references or pointers to the underlying
> (actual) container, and only *appear* to be containers, so they are far more
> efficient, as opposed to using actual containers.
>
> Optimizing compilers in many cases can optimize away mayfly objects
> completely; thus, mayfly objects are nice to allow complicated semantics
> with no overhead.
>
> Hope this helps.
>
> -Steve
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk