#683 Requesting value_type and unary operator-() in FieldVector.
Metadata
Property | Value |
---|---|
Reported by | Atgeirr Flø Rasmussen (atgeirr@sintef.no) |
Reported at | Dec 4, 2009 20:44 |
Type | Feature Request |
Version | Git (pre2.4) [autotools] |
Operating System | Unspecified / All |
Last edited by | Christian Engwer (christi@conan.iwr.uni-heidelberg.de) |
Last edited at | Jun 29, 2015 07:41 |
Closed by | Christian Engwer (christi@conan.iwr.uni-heidelberg.de) |
Closed at | Jun 29, 2015 07:41 |
Closed in version | Unknown |
Resolution | Implemented |
Comment | first proposal is implemented |
second proposal is "won't fix" |
Description
For easier interoperability with STL containers, it would be useful to have the field type as a value_type typedef. Example implementation:
//! export the type representing the components, STL style
typedef K value_type;
A separate issue is the availability of unary operator-(), which makes generic programming easier, for instance: T var; ... T signed_var = oriented ? var : -var; In this context, T cannot be a FieldVector without operator-(). Example implementation:
//! unary negation operator
FieldVector operator- () const
{
FieldVector z = *this;
for (size_type i=0; i<SIZE; i++)
z.p[i] = -z.p[i];
return z;
}