//                    (C) 2016 SiLeader.
// Distributed under the Boost Software License, Version 1.0.
//    (See accompanying file LICENSE_1_0.txt or copy at
//          http://www.boost.org/LICENSE_1_0.txt)
#pragma once

#include <developer_settings.hpp>

namespace STD
{
    template<class E> class initializer_list
    {
    public:
        using value_type=E;
        using reference=const E&;
        using const_reference=const E&;
        using size_type=STD::size_t;
        using iterator=const E*;
        using const_iterator=const E*;

    private:
        iterator m_array;
        size_type m_len;

        // The compiler can call a private constructor.
        constexpr initializer_list(const_iterator a, size_type l)
        : m_array(a), m_len(l)
        {

        }

    public:
        constexpr initializer_list() noexcept
        : m_array(0), m_len(0)
        {

        }

        // Number of elements.
        constexpr size_type size() const noexcept
        {
            return m_len;
        }

        // First element.
        constexpr const_iterator begin() const noexcept
        {
            return m_array;
        }

        // One past the last element.
        constexpr const_iterator end() const noexcept
        {
            return begin() + size();
        }
    };

    template<class T> constexpr const T* begin(initializer_list<Tp> ils) noexcept
    {
        return ils.begin();
    }

    template<class T> constexpr const T* end(initializer_list<Tp> ils) noexcept
    {
        return ils.end();
    }
}
