samedi 4 mars 2023

C++ name followed by '::' must be a class or namespace name and expected an identifier error on my code on 36th and 37th line

`#pragma once #include #include

struct Vector3 { constexpr Vector3( const float x = 0.f, const float y = 0.f, const float z = 0.f) noexcept : x(x), y(y), z(z) { }

constexpr const Vector3& operator-(const Vector3& other) const noexcept
{
    return Vector3{ x - other.x, y - other.y, z - other.z };
}

constexpr const Vector3& operator+(const Vector3& other) const noexcept
{
    return Vector3{ x + other.x, y + other.y, z + other.z };
}

constexpr const Vector3& operator/(const float factor) const noexcept
{
    return Vector3{ x / factor, y / factor, z / factor };
}

constexpr const Vector3& operator*(const float factor) const noexcept
{
    return Vector3{ x * factor, y * factor, z * factor };
}

constexpr const Vector3& ToAngle() const noexcept
{
    return Vector3{
        std::atan2(-z, std::hypot(x, y)) * (180.0f / std::numbers::pi_v<float>),
        std::atan2(y, x) * (180.0f / std::numbers::pi_v<float>),
        0.0f };
}

constexpr const bool IsZero() const noexcept
{
    return x == 0.f && y == 0.f && z == 0.f;
}

float x, y, z;

};

Aucun commentaire:

Enregistrer un commentaire