小编lev*_*ous的帖子

误导性编译器错误消息:size_t 不是 std 的成员?

我有以下包含模板类的头文件:

#ifndef VECTOR_H
#define VECTOR_H

namespace lgl
{
    namespace maths
    {
        template<class T, std::size_t SIZE>
        class Vector
        {
        public:
            Vector();
            Vector(T defaultValue);
            Vector(const Vector<T, SIZE>& other);
            Vector<T, SIZE>& operator=(const Vector<T, SIZE>& other);
            ~Vector();

            //accessors
            const std::size_t size() const;
            const T& operator[](std::size_t i) const;
            T& operator[](std::size_t i);

            //vector operations
            Vector<T, SIZE> operator+(const Vector<T, SIZE>& other) const;
            Vector<T, SIZE> operator-(const Vector<T, SIZE>& other) const;
            Vector<T, SIZE> operator*(const T& scalar) const ;
            Vector<T, SIZE> operator/(const T& scalar) const ;
            T operator*(const Vector<T, SIZE>& …
Run Code Online (Sandbox Code Playgroud)

c++ templates std size-t c++11

5
推荐指数
1
解决办法
6474
查看次数

标签 统计

c++ ×1

c++11 ×1

size-t ×1

std ×1

templates ×1