public member function
<locale>

std::locale::operator!=

bool operator!= (const locale& x) const;
Compare locales
Compares the locale against x, returning the opposite of operator==.

Parameters

x
locale object to compare.

Return value

true if the locales are different.
false otherwise.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
// locale::operator!= example
#include <iostream>       // std::cout
#include <locale>         // std::locale

int main ()
{
  if (std::cout.getloc() != std::locale("C"))
    std::cout << "cout is not using the C locale.\n";
  else
    std::cout << "cout is using the C locale.\n";

  return 0;
}

Possible output:
cout is using the C locale.


Data races

Both locale objects, x and *this are accessed.

Exception safety

Strong guarantee: if an exception is thrown, there are no changes in the objects.

See also