library-based property implementation

Hi All, I have been working on an implementation of a library that allows you to define properties, based on the wg21 N1615 paper by Lois Goldthwaite. The code is committed to the sandbox (under the property directory) with tests and preliminary documentation. I have seperated the properties into two. The boilerplate code for operator overloads, organised by rank, where rank is the number of indices (the term is borrowed from Tensor algebra) provides one group. The other group is the property storage that implements the get and set functions that the boilerplate classes use to implement the operator overloads. : Scalar Properties A scalar property is a single-element property. You can have simple properties that either store their values internally or reference an external data member: class object { int val; public: scalar_property< aliased_property< int > > Val; object(): Val( val ){} }; int main() { scalar_property< value_property< int > > ival( 0 ); ival = 7; ival += 3; int j; scalar_property< aliased_property< int > > jval( j ); jval = 2; assert( j == 2 ); } You can also define more complex properties that use class methods to control them: class object { int val; public: int get_Val() const{ return val; } void set_Val( const int & v ){ val = v; } scalar_property< object_property < int, object, &object::get_Val, &object::set_Val > > Val; object(): Val( this ){} }; : Rank 1 Properties A rank 1 property is a 1-dimensional property. For example: class result_set { public: // property record index[]; record get_record( int i ) const; void set_record( int i, record r ); boost::rank1_property< boost::rank1_object_property < record, int, result_set, &result_set::get_record, &result_set::set_record > > record; public: result_set(): record( this ) { } }; Regards, Reece

"Reece Dunn" wrote:
I have been working on an implementation of a library that allows you to define properties, based on the wg21 N1615 paper by Lois Goldthwaite. The code is committed to the sandbox (under the property directory) with tests and preliminary documentation.
Can you please post URL? /Pavel

Pavel Vozenilek wrote:
"Reece Dunn" wrote:
I have been working on an implementation of a library that allows you to define properties, based on the wg21 N1615 paper by Lois Goldthwaite. The code is committed to the sandbox (under the property directory) with tests and preliminary documentation.
Can you please post URL? /Pavel
Sure. As well as being in the sandbox, you can get the files at: http://uk.geocities.com/msclrhd/boost/property.zip The article N1615 is available at: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1615.pdf Regards, Reece
participants (2)
-
Pavel Vozenilek
-
Reece Dunn