1

I have gone through the documentation and looked at examples, but I am having trouble understanding the syntax of "operator(star)".

For example, if I have an array called "array1", and I want to multiply it by a value, 3, how would I incorporate the syntax:

array& operator*= ( const array & val ) ?

I am new to C++, and new to ArrayFire. Thank you!

AaronJPung
  • 1,105
  • 1
  • 19
  • 35
  • 1
    For starters, that operator overload cannot be used to "multiply it by a value " of 3, 5, or anything else. Secondly, this is one of the most advanced aspects of C++ that cannot be adequately explained in a short answer on stackoverflow.com. You need to get a good book on C++, and start reading. – Sam Varshavchik Sep 15 '16 at 02:38
  • @SamVarshavchik Based on the ArrayFire [page](http://arrayfire.org/docs/group__array__mem__operator__multiply__eq.htm), this function "Multiplies the value(s) of val to the elements of the array." I'm not sure how that operator, then, cannot multiply an array by a value. Again, new to C++ -- any additional explanation would be helpful. In the meantime, I'll work on getting a book on C++. – AaronJPung Sep 15 '16 at 02:42
  • That page lists multiple overloads. The one you showed in your question is not the one that would be used to multiply an object by a value, but by another array. – Sam Varshavchik Sep 15 '16 at 02:44
  • Great, thanks! As I mentioned, I'm new to ArrayFire -- could you offer the correct implementation / an example of what I'm looking for? – AaronJPung Sep 15 '16 at 02:50

0 Answers0