1

In ArrayFire source code, the definition of class Array (src/backend/cuda/Array.hpp) contains:

template<typename T>
class Array {
...

    operator Param<data_t<T>>() {
        return Param<data_t<T>>(this->get(), this->dims().get(),
                                        this->strides().get());
    }

    operator CParam<data_t<T>>() const {
        return CParam<data_t<T>>(this->get(), this->dims().get(),
                                         this->strides().get());
    }

...
};

Does anyone know what is the usage of operator keyword in C++?

SungSingSong
  • 81
  • 1
  • 2
  • 1
    See especially the part on [conversion operators](https://stackoverflow.com/a/16615725/136208). – AProgrammer Nov 28 '19 at 09:51
  • 1
    [conversion operator](https://en.cppreference.com/w/cpp/language/cast_operator) – Scheff's Cat Nov 28 '19 at 09:52
  • 1
    It performs a conversion to those types, Param> and CParam>. It will be called by an explicit cast of class Array to those types or an implicit conversion that fits. – mcabreb Nov 28 '19 at 10:17

0 Answers0