<sstream>

割り当てられた配列オブジェクトに格納されているシーケンスの iostreams 操作をサポートする、いくつかのクラス テンプレートを定義します。 クラス テンプレート basic_string のオブジェクトとの間で、このようなシーケンスが簡単に変換されます。

構文

namespace std {
template <class CharType, class Traits = char_traits<CharType>, class Allocator = allocator<CharType>>
class basic_stringbuf;
typedef basic_stringbuf<char>
stringbuf;
typedef basic_stringbuf<wchar_t> wstringbuf;

template <class CharType, class Traits = char_traits<CharType>, class Allocator = allocator<CharType>>
class basic_istringstream;
typedef basic_istringstream<char>
istringstream;
typedef basic_istringstream<wchar_t> wistringstream;

template <class CharType, class Traits = char_traits<CharType>, class Allocator = allocator<CharType>>
class basic_ostringstream;
typedef basic_ostringstream<char>
ostringstream;
typedef basic_ostringstream<wchar_t> wostringstream;

template <class CharType, class Traits = char_traits<CharType>, class Allocator = allocator<CharType>>
class basic_stringstream;
typedef basic_stringstream<char>
stringstream;
typedef basic_stringstream<wchar_t> wstringstream;
// TEMPLATE FUNCTIONS
template <class CharType, class Traits, class Allocator>
void swap(
    basic_stringbuf<CharType, Traits, Allocator>& left,
    basic_stringbuf<CharType, Traits, Allocator>& right);

template <class CharType, class Traits, class Allocator>
void swap(
    basic_istringstream<CharType, Traits, Allocator>& left,
    basic_istringstream<CharType, Traits, Allocator>& right);

template <class CharType, class Traits, class Allocator>
void swap(
    basic_ostringstream<CharType, Traits, Allocator>& left,
    basic_ostringstream<CharType, Traits, Allocator>& right);

template <class CharType, class Traits, class Allocator>
void swap (
    basic_stringstream<CharType, Traits, Allocator>& left,
    basic_stringstream<CharType, Traits, Allocator>& right);

}  // namespace std

パラメーター

left
sstream オブジェクトへの参照。

right
sstream オブジェクトへの参照。

解説

char * 型のオブジェクトでは、ストリーミングに <strstream >> の機能を使用することができます。 ただし、<strstream> は非推奨とされており、<sstream> を使用することをお勧めします。

Typedefs

型名 説明
istringstream char テンプレート パラメーターに特殊化された basic_istringstream 型を作成します。
ostringstream char テンプレート パラメーターに特殊化された basic_ostringstream 型を作成します。
stringbuf char テンプレート パラメーターに特殊化された basic_stringbuf 型を作成します。
stringstream char テンプレート パラメーターに特殊化された basic_stringstream 型を作成します。
wistringstream wchar_t テンプレート パラメーターに特殊化された basic_istringstream 型を作成します。
wostringstream wchar_t テンプレート パラメーターに特殊化された basic_ostringstream 型を作成します。
wstringbuf wchar_t テンプレート パラメーターに特殊化された basic_stringbuf 型を作成します。
wstringstream wchar_t テンプレート パラメーターに特殊化された basic_stringstream 型を作成します。

マニピュレーター

名前 説明
スワップ 2 つの sstream オブジェクト間で値を交換します。

クラス

クラス 説明
basic_stringbuf 文字の特徴がクラス Tr によって決まる型 Elem の要素の、配列オブジェクトに格納されている要素のシーケンスとの間での転送を制御するストリーム バッファーについて説明します。
basic_istringstream Elem 型の要素を含む basic_stringbuf<Elem, Tr, Alloc> クラスのストリーム バッファーから要素とエンコードされたオブジェクトを抽出する際の、抽出を制御するオブジェクトを記述します。Elem 型の文字特性は Tr クラスによって決められ、その要素は Alloc クラスのアロケーターによって割り当てられます。
basic_ostringstream Elem 型の要素を含む basic_stringbuf<Elem, Tr, Alloc> クラスのストリーム バッファーへ要素とエンコードされたオブジェクトを挿入する際の、挿入を制御するオブジェクトを記述します。Elem 型の文字特性は Tr クラスによって決められ、その要素は Alloc クラスのアロケーターによって割り当てられます。
basic_stringstream Elem 型の要素を含む basic_stringbuf<Elem, Tr, Alloc> クラスのストリーム バッファーを使用して要素とエンコードされたオブジェクトを挿入および抽出する際の、挿入と抽出を制御するオブジェクトを記述します。Elem 型の文字特性は Tr クラスによって決められ、その要素は Alloc クラスのアロケーターによって割り当てられます。

必要条件

  • ヘッダー:<sstream>

  • 名前空間: std

関連項目

ヘッダー ファイル リファレンス
C++ 標準ライブラリ内のスレッド セーフ
iostream プログラミング
iostreams の規則