why can we use stoi or stoll without "using namespace std"? [duplicate]

  c++, namespaces, std

As I know, stoll or stoi is declared in namespace of std.

But without std:: prefix, the below code is complied.

Why is it so?

#include <iostream>
#include <string>

int main(void)
{
    std::string s{"123"};
    long long a = stoll(s);
    int b = stoi(s);

    std::cout<<a<<std::endl;
    std::cout<<b<<std::endl;

    return 0;

Source: Windows Questions C++

LEAVE A COMMENT