模板运算符[]重载奇怪的C2676

我正在尝试在模板化类中重载[int]运算符,但始终会出现C2676错误,然后是Visual Studio E0349“没有运算符[]匹配这些运算符WMSTR [int]”

我的模板类:

template <typename T, unsigned int N>
class MyString{
    public:

    // ... Non relevant tested code

    template<typename T, unsigned int N>
    T& operator[](int index) {
        // Assert index size
        SLOW_ASSERT(index >= 0 && index < N);
        // Return current value
        return m_buffer[index];
    }

    template<typename T, unsigned int N>
    const T& operator[](int index) const {
        // Assert index size
        SLOW_ASSERT(index >= 0 && index < N);
        // Return current value
        return m_buffer[index];
    }

    private:
    T m_buffer[N];
}

SLOW_ASSERT(...)只是要声明的包装器(...)

主要内容:

#include "path_to_template.h"
typedef MyString<wchar_t, 24> WMSTR;

int main(void){
   WMSTR str = L"Test";
   str[0] = L'X'; // <-- Error here

   return 0;
}