-5

What are all the functions (ex std::cout, std::cin, etc.) that need the std:: when not using namespace std?It would be useful to know so I don’t run into problems, thanks!

  • 1
    They are pretty much all here: https://en.cppreference.com/w/ – Galik Jan 28 '19 at 01:41
  • If you are using something from the standard library just use `std::`. – NathanOliver Jan 28 '19 at 01:42
  • 1
    don't use `using namespace std` and you won't have problems https://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice – bolov Jan 28 '19 at 01:44
  • I plan to not use using namespace std, I was just wondering what I would need to use std:: in front of. – Javis Johnson Jan 28 '19 at 01:46
  • It looks like what you are asking about is [ADL](https://stackoverflow.com/questions/8111677/what-is-argument-dependent-lookup-aka-adl-or-koenig-lookup). – NathanOliver Jan 28 '19 at 01:51
  • `std::cout` and `std::cin` are not functions. They’re objects. – Pete Becker Jan 28 '19 at 02:55
  • If you're using anything in the C++ standard library, types and names are in namespace `std`. There are some exceptions (e.g. macros that derive from C headers) but, unless you use C library facilities you won't often encounter them. User code (i.e. other than the standard library) cannot place names in `std` without causing undefined behaviour (with a couple of exceptions, such specialising template functions to accept user-defined types, such as `std::swap()`). – Peter Jan 28 '19 at 03:22

1 Answers1

1

The ISO C++ standards specify that "all library entities are defined within namespace std", so you're looking for the entire libstdc++ namespace. It is provided here:

https://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01544.html

Heath Raftery
  • 3,643
  • 17
  • 34
  • thats actually a pretty good list with the caveat that anything prefixed with an `_` is implementation dependent and not part of the C++ standard – kmdreko Jan 28 '19 at 03:15
  • `libstdc++` is _an_ implementation of the Standard Library. There are more, and the ISO C++ Standard allows implementations to have additional names in `std`. – MSalters Jan 28 '19 at 12:15