Intel® oneAPI DPC++/C++ Compiler Developer Guide and Reference

ID 767253
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

ConstProxy

ConstProxy object provides access to a specific constant primitive, primitive data member, or nested data member within a primitive for an element in a container.

Description

const_accessor [index] or a ConstProxy object’s Data Member Interfaces return ConstProxy objects. That ConstProxy object represents the constant primitive, primitive data member, or nested data member within a primitive for an element in a container. The ConstProxy object has the following features:

  • A value_type can be exported or imported from the ConstProxy.

    • Conversion operator is used to export the value_type

    • Alternatively the ConstProxy can be passed to the function unproxy to export a value_type

  • Overloads the following operators if the underlying value_type supports the operator

    • ==, !=, <, >, <=, >=, +, -, *, /, %, &&, ||, &, |, ^, ~, *, +, -, !

    • When an operator is called the following occurs:

      • value_type is exported

      • The operator applied to the exported value

      • returns the result.

  • Data Member Interface.

    • For each data member of value_type

      • A member access method is defined which returns a Member ConstProxy representing just that member.

Member Type

Description

typedef implementation-defined value_type

The type of the data the ConstProxy is representing

Member

Description

operator value_type const () const;

Returns: exports a copy of the ConstProxy’s value.

NOTE: constant return value prevents rvalue assignment for structs offering some protection against code that expected a modifiable reference.

auto name_of_values_data_member_1()const;

Returns: ConstProxy instance representing the 1st data member of the value_type

NOTE: actual method name is the name of the value_type’s 1st data member

auto name_of_values_data_member_2()const;

Returns: ConstProxy instance representing the 2nd data member of the value_type.

NOTE: actual method name is the name of the value_type’s 2nd data member.

auto name_of_values_data_member_...()const;

Returns: ConstProxy instance representing the ...th data member of the value_type.

NOTE: actual method name is the name of the value_type’s ...th data member.

auto name_of_values_data_member_N()const;

Returns: ConstProxy instance representing the Nth data member of the value_type.

NOTE: actual method name is the name of the value_type’s Nth data member