Exemplo n.º 1
0
Arquivo: stack.hpp Projeto: louis-/rpn
    /// @brief copy a whole stack entry and push it back to another stack
    ///
    /// @param from copy from
    /// @param index_from index t ocopy from
    /// @param to copy to
    ///
    static void copy_and_push_back(object* from, stack& to, unsigned int size) {
        object* allocated = to.allocate_back(size, from->_type);
        memcpy(allocated, from, size);

        if (allocated->_type == cmd_number)
            ((number*)allocated)->move();
        else if (allocated->_type == cmd_complex)
            ((complex*)allocated)->move();
    }
Exemplo n.º 2
0
Arquivo: stack.hpp Projeto: louis-/rpn
    /// @brief copy a whole stack entry and push it back to another stack
    ///
    /// @param from copy from
    /// @param index_from index t ocopy from
    /// @param to copy to
    ///
    static void copy_and_push_back(stack& from, unsigned int index_from, stack& to) {
        object* allocated = to.allocate_back(from.seq_len(index_from), from.seq_type(index_from));
        memcpy(allocated, from.seq_obj(index_from), from.seq_len(index_from));

        if (allocated->_type == cmd_number)
            ((number*)allocated)->move();
        else if (allocated->_type == cmd_complex)
            ((complex*)allocated)->move();
    }