每个区域目录被分成几个领域
每个领域都是一些对应于相应目录封装了特定功能的类
目录monetary包含的领域有money_get money_put moneypunct
//: C04:Facets.cpp {-bor}{-g++}{-mwcc}{-edg}
// From "Thinking in C++, Volume 2", by Bruce Eckel & Chuck Allison.
// (c) 1995-2004 MindView, Inc. All Rights Reserved.
// See source code use permissions stated in the file 'License.txt',
// distributed with the code package available at www.MindView.net.
#include <iostream>
#include <locale>
#include <string>
using namespace std;
int main() {
// Change to French/France
locale loc("french");
cout.imbue(loc);
string currency =
use_facet<moneypunct<char> >(loc).curr_symbol();
char point =
use_facet<moneypunct<char> >(loc).decimal_point();
cout << "I made " << currency << 12.34 << " today!"
<< endl;
getchar();
} ///:~
可以定制自己的领域以构建个人化的区域
要当心,区域的开销可观
输出
I made €12,34 today!