注册 登录
编程论坛 C++教室

请问什么是“value type”

chenkuanyi 发布于 2008-10-29 14:04, 899 次点击
请问什么是“value type”
2 回复
#2
冰烨2008-10-29 16:43
In object-oriented programming, a value type is a data type that can exist outside dynamic memory allocation. Unlike reference types, value types can be directly embedded into composite objects.

Primitive types are always value types.

Value types can exist in dynamically allocated memory, such as embedded into a dynamic object. Some platforms also allow direct dynamic allocation of value objects, while others require the value to be copied into a specific dynamic object. The later process is called boxing.

On some platforms, a value may be directly linked to by a pointer or reference. On others, it is a prerogative or reference types.
#3
随心2008-10-29 16:49
代表一种类型吧
比如map定义的类型
map<K,V>::key_type
map<K,V>::mapped_type
map<K,V>::value_type
1