Stack inbuilt function in stl

What is emplace() function and why it is not working in dev c++ IDE .plz reply

@guptagchandan123123, Stack emplace ,Adds a new element at the top of the stack , above its current top element . This new element is constructed in place passing args as the arguments for its constructor.

#include <iostream>       // std::cin, std::cout
#include <stack>          // std::stack
#include <string>         // std::string, std::getline(string)

int main ()
{
  std::stack<std::string> mystack;

  mystack.emplace ("First sentence");
  mystack.emplace ("Second sentence");

  std::cout << "mystack contains:\n";
  while (!mystack.empty())
  {
    std::cout << mystack.top() << '\n';
    mystack.pop();
  }

  return 0;
}

Output :-
mystack contains:
Second sentence
First sentence

This function is only supported by c++ version 11 or higher so check your compiler version and set it to higher compiler version

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.