Writable Property Map

转自:http://www.boost.org/doc/libs/1_47_0/libs/property_map/doc/WritablePropertyMap.html

Writable Property Map

A Writable Property Map has the capability of setting the value object associated with the given key object via the put() function.

Refinement of

Copy Constructible

Notation

PMapA type that is a model of Writable Property Map.
pmapAn object of type PMap.
keyAn object of type boost::property_traits<PMap>::key_type.
valAn object of type boost::property_traits<PMap>::value_type.

Associated Types

Value Typeboost::property_traits<PMap>::value_typeThe type of the property.
Key Typeboost::property_traits<PMap>::key_typeThe type of the key object used to look up the property. The property map may be templated on the key type, in which case this typedef can be void.
Property Map Categoryboost::property_traits<PMap>::categoryThe category of the property: a type convertible to writable_property_map_tag.

Valid Expressions

NameExpressionReturn TypeDescription
Put Property Value[1]put(pmap, key, val)voidAssign val to the property associated with k.

Notes

[1] The function put() was originally named set(), but was changed to avoid name conflicts with the std::set class when using a compiler (Microsoft Visual C++) with non-standard name lookup rules. The following example demonstrates the problem.

#include <set>
using namespace std;
namespace boost {
  void set() { }
}

Concept Checking Class

template <class PMap, class Key>
  struct WritablePropertyMapConcept
  {
    typedef typename property_traits<PMap>::key_type key_type;
    typedef typename property_traits<PMap>::category Category;
    typedef boost::writable_property_map_tag WritableTag;
    void constraints() {
      function_requires< ConvertibleConcept<Category, WritableTag> >();
      put(pmap, k, val);
    }
    PMap pmap;
    Key k;
    typename property_traits<PMap>::value_type val;
  };

See Also

Property map concepts

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值