#ifndef ARRAY_HPP
#define ARRAY_HPP

#include "symbol.hpp"
#include <vector>

class array : public symbol_impl {
    std::vector<symbol> vals;

public :
    array();

    void push(symbol&& s);
    size_t size() const;

    symbol& operator [] (size_t i);
    const symbol& operator [] (size_t i) const;

    template<typename T>
    T& as(size_t i) {
        return vals[i].as<T>();
    }

    template<typename T>
    const T& as(size_t i) const {
        return vals[i].as<T>();
    }

    array* clone() const override;
    array* evaluate(const interpreter_context& context) const override;
    std::string serialize(const interpreter_context& context) const override;
    const std::string& type() const override;
    bool is_litteral() const override;
    std::pair<size_t,size_t> priority(const interpreter_context&) const override;

    static const std::string type_name;

    static void reg(interpreter_context& context);
};

#endif
