共用方式為


basic_string::const_reference

A type that provides a reference to a const element stored in a string for reading and performing const operations.

typedef typename allocator_type::const_reference const_reference;

Remarks

A type const_reference cannot be used to modify the value of an element.

The type is a synonym for allocator_type::const_reference. For string type, it is equivalent to const char&.

Example

See the example for at for an example of how to declare and use const_reference.

Requirements

Header: <string>

Namespace: std

See Also

Reference

basic_string Class

Other Resources

basic_string Members