template <class Facet>
locale combine(const locale& other) const; // (1) C++98
概要
別のロケールのファセットを組み込んだ新たなlocaleを構築する。
*thisのすべてのファセットに加えて、otherが持つ型Facetのファセットを組み込んだlocaleを作成する。
戻り値
*thisのコピーに対して、otherが持つ型Facetのファセットを組み込んだlocale。
例外
has_facet<Facet>(other)がfalseの場合、std::runtime_error例外を送出する。
備考
この関数で構築されたlocaleは名前を持たない(name()は"*"を返す)。
例
#include <iostream>
#include <locale>
int main()
{
std::locale c = std::locale::classic();
std::locale jp("");
// cロケールに、jpロケールのnumpunct<char>ファセットを組み込む
std::locale combined = c.combine<std::numpunct<char>>(jp);
std::cout << std::boolalpha;
std::cout << (combined == c) << std::endl;
}
出力例
false
バージョン
言語
- C++98