Indexer (programming): Difference between revisions

Content deleted Content added
Dmt137 (talk | contribs)
m Python: wording
Dmt137 (talk | contribs)
m C++: wording
Line 4:
== Implementations ==
=== C++ ===
In C++ one can emulate indexing by overloading the {{c++|[]}} operator. Specifically, theThe expression {{c++|a[b...]}} translates to a call to the user-defined function {{c++|operator[]}} as {{c++|(a).operator[](b...)}}<ref>{{cite web|url=https://en.cppreference.com/w/cpp/language/operators|title=cppreference}}</ref>. Here is an example,
 
==== Example ====
<syntaxhighlight lang="c++">
struct vector{