通貨値を表す文字のシーケンスに、数字または文字列をに変換します。
iter_type put(
iter_type _Next,
bool _Intl,
ios_base& _Iosbase,
CharType _Fill,
const string_type& _Val
) const;
iter_type put(
iter_type _Next,
bool _Intl,
ios_base& _Iosbase,
CharType _Fill,
long double _Val
) const;
パラメーター
_Next
挿入するテキスト文字列の最初の要素を指定する反復子。_Intl
シーケンスで想定される通貨記号の種類を示すブール値: true International 場合、false 各国の場合は。_Iosbase
通貨記号は省略可能であることを示す場合は書式指定フラグ; それ以外の場合は必須です_Fill
スペーシングに使用される文字。_Val
変換対象の文字列オブジェクト。
戻り値
出力反復子最後の要素を越える位置 1 によって生成されるアドレス。
解説
両方のメンバー関数は do_put (_Next、_Intl、_Iosbase、_Fill、_Val)。
使用例
// money_put_put.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>
#include <sstream>
using namespace std;
int main( )
{
// locale loc( "german_germany" );
locale loc( "english_canada" );
basic_stringstream<char> psz, psz2;
ios_base::iostate st = 0;
psz2.imbue( loc );
psz2.flags( psz2.flags( )|ios_base::showbase ); // force the printing of the currency symbol
use_facet < money_put < char > >(loc).put(basic_ostream<char>::_Iter( psz2.rdbuf( ) ), true, psz2, st, 100012);
if (st & ios_base::failbit)
cout << "money_put( ) FAILED" << endl;
else
cout << "money_put( ) = \"" << psz2.rdbuf( )->str( ) <<"\""<< endl;
st = 0;
};
必要条件
ヘッダー: <locale>
名前空間: std