template class utils::Couple — HIRO 0.7.0 documentation

# template class utils::Couple

## Overview

Structure holding two variables of the same type. More…

    #include <Couple.h>

    template <typename Type>
    class Couple {
    public:
        // construction

        Couple();
        Couple(Type val_1, Type val_2);

        // methods

        void Set(Type val_1, Type val_2);
        bool Contains(const Type value) const;
        Type& operator[](size_t idx);
        const Type& GetFirst() const;
        void SetFirst(Type value);
        const Type& GetSecond() const;
        void SetSecond(Type value);
        bool operator==(const Couple<Type>& other);
        bool operator!=(const Couple<Type>& other);
        Couple& operator+=(const Type val);
        Couple& operator*=(const Type val);
    };

## Detailed Documentation

Structure holding two variables of the same type.

### Methods

    void Set(Type val_1, Type val_2)

Sets values.

    bool Contains(const Type value) const

Checks if at least one of the two is equal to the value.

    Type& operator[](size_t idx)

Returns reference to the value by a specified index.

    const Type& GetFirst() const

Returns the first value.

    void SetFirst(Type value)

Sets the first value.

    const Type& GetSecond() const

Returns the second value.

    void SetSecond(Type value)

Sets the second value.

    bool operator==(const Couple<Type>& other)

Compares two couples. The order of values is not important.

    bool operator!=(const Couple<Type>& other)

Compares two couples. The order of values is not important.

    Couple& operator+=(const Type val)

Increases both values by a specific amount.

    Couple& operator*=(const Type val)

Multiples both values with a specific value.