"Anthony Williams" <[EMAIL PROTECTED]> wrote in message news:15824.50990.811000.938157@;gargle.gargle.HOWL... > Edward Diener writes: > >I know that I am missing how the mechanism works which links > > the property_map concept to the get(), put(), and operator[] functions. > > A property map is something which relates "keys" to "values", where there "keys" > are the "names" of the properties. Given a property map, you can get and/or > set the "value" associated with each "key" using the get() and put() > functions. > > You can build a property map out of anything at all, just by defining the > necessary interface. For example, you could build a property map that returned > the values of class members by name, or one that returned the n-th number in a > mathematical sequence, given n. > > The idea is that in your generic code, you say "give me a property map which I > can use with the following keys to return values of type T", and it is then up > to the client code how they implement that property map --- _anything_ which > provides the necessary interface will do. > > operator[] is essentially just syntactic sugar for get()/put(), where the > values are real, discernable objects, for which you can obtain a > reference. Returning a reference means that you can store the reference for > later use, or pass it to another function, and is actually the key benefit of > using operator[] rather than plain get()/put().
Thanks. Your explanation makes much better sense to me than anything I have been able to understand in the property map docs. Here are some simple questions which, if you can take the time to answer them, might get me over the hurdle of trying to understand and let me use the generic functions on my own property maps: 1) Are the get(), put() functions somewhere, like in the boost namespace ? Is there a doc for the parameters these functions take, or is it the intent that if one wants to use them, one looks in the source code to figure them out ? 2) What is the necessary interface to a property map which you mention above. I see property map categories, property traits, property map types, but I am missing an understanding from the documentation of the necessary interface for creating a property map ? Finally I would like a non-partisan answer from you to my next question and I am perfectly willing to be wrong and accept the fact that my lack of understanding of "concept" based explanations are at fault. Do you feel that the answers to my 2 questions are readily apparent to most intelligent C++ programmers from reading the property map docs ? _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost