[ Web Proxy ]
URL:
Viewing: http://ja.cppreference.com/cpp/io/basic_stringbuf/basic_stringbuf [Back]  [Original]

std::basic_stringbuf<CharT,Traits,Allocator>::basic_stringbuf - cppreference.com
cppreference.com

std::basic_stringbuf<CharT,Traits,Allocator>::basic_stringbuf

: cppreference.com
<tbody> </tbody> <tbody class="t-dcl-rev t-dcl-rev-num "> </tbody><tbody> </tbody>
basic_stringbuf() : basic_stringbuf(std::ios_base::in | std::ios_base::out) { }
(1)
(2)
explicit basic_stringbuf( std::ios_base::openmode which = std::ios_base::in | std::ios_base::out );
(C++11)
explicit basic_stringbuf( std::ios_base::openmode which );
(C++11)
explicit basic_stringbuf( const std::basic_string<CharT, traits, Allocator>& new_str, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out );
(3)
basic_stringbuf( const basic_stringbuf& rhs ) = delete;
(4) (C++11)
basic_stringbuf( basic_stringbuf&& rhs );
(5) (C++11)
1) (eback() gptr() egptr() pbase() pptr() epptr())
2) std::basic_stringbuf std::basic_streambuf which
3) 1) str(new_str) std::basic_stringbuf
4) std::basic_stringbuf CopyConstructible
5) std::basic_stringbuf rhs () std::basic_stringbuf *this std::basic_streambuf 6 rhs

new_str - basic_string
rhs - basic_stringbuf
which -
app
binary
in
out
trunc
ate

std::basic_stringstream

std::ios_base::in std::ios_base::out C++11 str() std::ios_base::ate std::ios_base::app std::ios_base::trunc std::ios_base::binary

C++

DR
P0935R0 C++11 default constructor was explicit made implicit

basic_stringbuf

#include <iostream>
#include <sstream>

int main()
{
    // default constructor (mode = in|out)
    std::stringbuf buf1;
    buf1.sputc('1');
    std::cout << &buf1 << '\n';

    // string constructor in at-end mode (C++11)
    std::stringbuf buf2("test", std::ios_base::in
                              | std::ios_base::out
                              | std::ios_base::ate);
    buf2.sputc('1');
    std::cout << &buf2 << '\n';

    // append mode test (results differ among compilers)
    std::stringbuf buf3("test", std::ios_base::in
                              | std::ios_base::out
                              | std::ios_base::app);
    buf3.sputc('1');
    buf3.pubseekpos(1);
    buf3.sputc('2');
    std::cout << &buf3 << '\n';
}

:

1
test1
est12 (Sun Studio) 2st1 (GCC)


(std::basic_stringstream<CharT,Traits,Allocator>) [edit]

Web Proxy Viewer  |  New URL  |  Original Page