|
Boost : |
From: christopher diggins (cdiggins_at_[hidden])
Date: 2005-01-28 19:15:44
----- Original Message -----
From: "Jonathan Turkanis" <technews_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Friday, January 28, 2005 6:00 PM
Subject: [boost] Re: BIL and boost::any
> One can think of smart references as generalizations of any in which
>
> - the ownership policy can vary; e.g., it could be reference-counted
> instead of
> clone-on-copy
> - the type of admissible objects can restricted using interfaces
> - the syntax for binding is slightly different
>
> For instance, a reference-counted any that can bind to anything is
> shared_obj<IAnything>.
Would it be a reasonable request then to have clone(interface_value)? Would
make sense to also have dynamic traits, i.e. is_clonesable(interface_value).
This seems to be pointing down a path of never ending feature requests to
interface. I think it would be nice to lay down an easily extendible
interface type. I mentioned earlier about allowing users to extend interface
types. One way which I would like to extend interface types is to have an
interface type which provides an extra function:
Usage:
dynamic_traits traits = extract_traits(interface_value);
dyanmic_traits could be a class which provides run-time functions like:
is_copy_constructible();
is_default_constructible();
size_of();
is_primitive();
is_integral();
etc.
> I'm thinking of adding a template boost::interfaces::any, which has
> cloning
> semantics and uses the same syntax as any for binding, i.e., assignment
> and
> construction from a const reference.
>
> template<typename Interface = IAnything>
> class any;
>
> (I think boost::interfaces::null might be a better name for IAnything.)
How about IUnknown? It will be especially meaningful when boost::interfaces
allow dynamic introspection.
> However, maybe what is needed instead is just a policy-based smart
> reference.
That would be a good thing.
Excited about C++ again,
Christopher
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk