Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-06-25 10:15:40

On Tuesday 25 June 2002 09:50 am, Ruslan Zasukhin wrote:
> Okay, but template-based solution is LIMITED for use on compile-time.

In the general case, this is not true: you can always build an adaptor to
bridge to a run-time--determined entity. You then instantiate the template
with this adaptor, and then you can use any class that conforms to the
interface required by the adaptor with that instantiation. Boost.Function is
one such adaptor for function objects; Boost.Any is another adaptor for
CopyConstructible types.

> In database application or script languages, for example,
> variant values are created at run-time,
> So as far as I see, templates not work here. Agree?

If the set of types cannot be known at compile time, then I agree.

> This is why for such applications we need
> Class IValue {}
> Class IntValue : public IValue {}
> Class FloatValue : public IValue {}
> Class StringValue : public IValue {}
> And so on.

And somebody can come in later and create another subclass of IValue without
changing the variant type definition, I assume? What are the requirements on
objects that derive from IValue? Do they differ significantly from the
CopyConstructible requirements? A comparison of the interfaces of this
variant vs. Boost.Any would help to understand why another variant type would
be needed.

> Does BOOST org interested in such solutions?

I'm sure there are people here who would use such solutions; it's very hard to
gauge interest in a particular library component, but eventually some ideas
gain a critical mass that results in a new library being added into Boost.


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