-1
T & operator()(int x、int y)関数の定義方法を理解できません。 私はArray.hファイルにこの機能を持っています。だから私はそれをArray.hppファイルに定義する必要があります。誰も考えていますか?テンプレートを使用した演算子での実装
#ifndef _ARRAY_
#define _ARRAY_
namespace math
{
/*! The Array class implements a generic two-dimensional array of elements of type T.
*/
template <typename T>
class Array
{
protected:
//! Flat storage of the elements of the array of type T
T * buffer;
unsigned int width,
height;
/* Returns a reference to the element at the zero-based position (column x, row y).
*
* \param x is the zero-based column index of the array.
* \param y is the zero-based row index of the array.
*
* \return a reference to the element at position (x,y)
*/
T & operator() (int x, int y);
};
} // namespace math
#include "Array.hpp"
#endif
アウトラインで定義する方法をお尋ねしますか?またはそれを実装する方法? – doctorlove
@doctorlove私はそれを定義する方法を尋ねます、ありがとう – madrugadas25845