About 1,190,000 results
Open links in new tab
  1. subscript operator in C++ - Stack Overflow

    Jun 6, 2015 · The subscript operator is a binary operator in the strict sense as it takes two arguments, the reference to the object and the value.

  2. C++ [] array operator with multiple arguments? - Stack Overflow

    As a workaround, you instead can overload operator(). (See How do I create a subscript operator for a Matrix class? from the C++ FAQ.) From C++23, as mentioned in a (deleted) answer by …

  3. operator overloading [][] 2d array c++ - Stack Overflow

    Dec 25, 2015 · I have a 2D array and I want to define a function that returns the value of the index that the user gives me using operator overloading. In other words: void …

  4. c++ - subscript operator on pointers - Stack Overflow

    Nov 3, 2016 · It's because you can't overload operators for a pointer type; you can only overload an operator where at least one of the parameters (operands) is of class type or enumeration …

  5. c++ - Overloading subscript operator [] - Stack Overflow

    Mar 4, 2011 · Why does it require to be a member function of a class for its operation and is good to return a reference to private member? class X { public: int& operator[] (const size_t); …

  6. How to override the [] operator in Python? - Stack Overflow

    Dec 24, 2009 · What is the name of the method to override the [] operator (subscript notation) for a class in Python?

  7. overloading assignment operator With subscript operator - Stack …

    7 I overloaded both subscript operator and assignment operator and I am trying to get right value to assignment operator example Array x; x[0]=5; by overloading subscript operator i can get …

  8. c++ two versions of overloading subscript operator

    Jan 13, 2014 · c++ two versions of overloading subscript operator Asked 12 years, 8 months ago Modified 11 years, 10 months ago Viewed 13k times

  9. Why doesn't `std::initializer_list` provide a subscript operator?

    Oct 9, 2015 · Suppose that you are writing a function that accepts an std::initializer_list called list, and that the function requires random access to list's elements. It would be convenient to write …

  10. type 'set<int>' does not provide a subscript operator

    Mar 26, 2023 · The compiler is correct. A std::set does not have a subscript operator. In general, containers with an operator[] uses this to provide constant time lookups of elements. In an …