Language: C++

#include <iostream>
#include <sstream>
#include <vector>
template <typename T, unsigned N>
    class stack {
    public:
        stack() : _data{new T[N]}, _top(0) {}
        ~stack() {delete[] _data;}
        T top() const {
            return _data[_top];
        }
        bool isEmpty() const {
            return _top == 0;
        }
        T pop() {
            assert(_top != 0);
            T data = this->top();
            _data[_top] = 0;
            --_top;
            return data;
        }
        void push(const T& x) {
            assert(_top < N);
            ++_top;
            _data[_top] = x;
        }
        bool isFull() const {
            return _top > N - 1;
        }
    private:
        T* _data;
        unsigned _top;
    };

  int evaluate(const std::vector<std::string>& vec)
    {
        stack<int, 3> stack;
        for (std::string v : vec) {
            if (v == "+") {
               stack.push(stack.pop() + stack.pop());
            }
            else if (v == "-") {
                stack.push(stack.pop() - stack.pop());
            }
            else if (v == "*") {
                stack.push(stack.pop() * stack.pop());
            }
            else {
                int i;
                std::istringstream ss(v);
                ss >> i;
                stack.push(i);
            }
            std::cout << "top is ";
            std::cout << stack.top() << std::endl;
            std::cout << " stack size is full ?"  << stack.isFull() << std::endl;
            std::cout << "stac size is " << stack.top() << std::endl;
        }
        return stack.pop();
    }

  std::string input;
   std::getline(std::cin, input);
   std::stringstream ss(input);
   std::vector<std::string> vec;
   std::copy(std::istream_iterator<std::string>(ss),
             {}, std::back_inserter(vec));

   int result = evaluate(vec);

Compiler output:
a.cc: In member function 'T stack<T, N>::pop()':
a.cc:16:13: error: there are no arguments to 'assert' that depend on a template parameter, so a declaration of 'assert' must be available [-fpermissive]
   16 |             assert(_top != 0);
      |             ^~~~~~
a.cc:16:13: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
a.cc: In member function 'void stack<T, N>::push(const T&)':
a.cc:23:13: error: there are no arguments to 'assert' that depend on a template parameter, so a declaration of 'assert' must be available [-fpermissive]
   23 |             assert(_top < N);
      |             ^~~~~~
a.cc: At global scope:
a.cc:63:16: error: expected constructor, destructor, or type conversion before '(' token
   63 |    std::getline(std::cin, input);
      |                ^
a.cc:66:13: error: expected constructor, destructor, or type conversion before '(' token
   66 |    std::copy(std::istream_iterator<std::string>(ss),
      |             ^
a.cc:67:16: error: expected unqualified-id before ',' token
   67 |              {}, std::back_inserter(vec));
      |                ^
a.cc:67:36: error: expected constructor, destructor, or type conversion before '(' token
   67 |              {}, std::back_inserter(vec));
      |                                    ^
a.cc: In instantiation of 'T stack<T, N>::pop() [with T = int; unsigned int N = 3]':
a.cc:40:36:   required from here
   40 |                stack.push(stack.pop() + stack.pop());
      |                           ~~~~~~~~~^~
a.cc:16:19: error: 'assert' was not declared in this scope
   16 |             assert(_top != 0);
      |             ~~~~~~^~~~~~~~~~~
a.cc:4:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    3 | #include <vector>
  +++ |+#include <cassert>
    4 | template <typename T, unsigned N>
a.cc: In instantiation of 'void stack<T, N>::push(const T&) [with T = int; unsigned int N = 3]':
a.cc:40:26:   required from here
   40 |                stack.push(stack.pop() + stack.pop());
      |                ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:23:19: error: 'assert' was not declared in this scope
   23 |             assert(_top < N);
      |             ~~~~~~^~~~~~~~~~
a.cc:23:19: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'