|
Boost : |
Subject: Re: [boost] [review][constrained_value] ReviewofConstrainedValueLibrary begins today
From: Chris (indy271828_at_[hidden])
Date: 2008-12-07 18:37:06
Robert Kawulak wrote:
>> From: Robert Kawulak
>>
>>> From: Chris
>>> Or add something like this:
>>> class A {
>>>
>>> A() { // fails
>>> }
>>>
>>> must_initialize<int> t;
>>> };
>>>
>> The problem is that the fact whether the default value is
>> valid or not depends on the constraint used and this can't be
>> verified at compile-time in most cases.
>>
>
> This is even more tricky, because in some cases the error policy is able to
> adjust the value to make it constraint conforming. So should the default
> construction be disabled in such cases too or not?
>
Sorry I did not clarify that there were no default template parameters.
(no error policy)
must_initialize was not referring to any of your constrained classes.
It was just a simple class to be added to your library if you wanted,
that forces the user to initialize a variable. That is the compile time
constraint.
template <typename T>
class must_initialize
{
public:
must_initialize(T t) : _value(t) { }
// operater overloads here
private:
must_initialize();
T _value;
};
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk