Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The lastprivate clause provides a superset of the functionality provided by the private clause. The syntax of the lastprivate clause is as follows:
lastprivate
(variable-list)
Variables specified in the variable-list have private clause semantics. When a lastprivate clause appears on the directive that identifies a work-sharing construct, the value of each lastprivate variable from the sequentially last iteration of the associated loop, or the lexically last section directive, is assigned to the variable's original object. Variables that are not assigned a value by the last iteration of the for or parallel for, or by the lexically last section of the sections or parallel sections directive, have indeterminate values after the construct. Unassigned subobjects also have an indeterminate value after the construct.
The restrictions to the lastprivate clause are as follows:
All restrictions for
privateapply.A variable with a class type that is specified as
lastprivatemust have an accessible, unambiguous copy assignment operator.Variables that are private within a parallel region or that appear in the
reductionclause of a parallel directive cannot be specified in alastprivateclause on a work-sharing directive that binds to the parallel construct.