[#BloombergLP-bdlat_ArrayFunctions-accessElement]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlat_ArrayFunctions.adoc[bdlat&lowbar;ArrayFunctions]::accessElement
:relfileprefix: ../../
:mrdocs:

Invoke the specified `accessor` on the non&hyphen;modifiable element at the specified `index` of the specified `array`&period;

== Synopsis

Declared in `&lt;bdlat&lowbar;arrayfunctions&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class TYPE,
    class ACCESSOR&gt;
int
accessElement(
    TYPE const& array,
    ACCESSOR& accessor,
    int index);
----

== Description

The supplied `accessor` must be a callable type that can be called as if it had the following signature&colon; &grave; int accessor(const ELEMENT&lowbar;TYPE&amp; element)&semi; &grave; Return the value from the invocation of `accessor`&period; The behavior is undefined unless `0 &lt;&equals; index` and `index &lt; size(array)`&period;

== Return Value

result of invoking `accessor`

== Parameters

[cols="1,4"]
|===
| Name| Description
| *array*
| array whose element is accessed
| *accessor*
| functor applied to the element at `index`
| *index*
| position of the element to access
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
