commit 2f5ff424d5e0031f206fd96f3fe5c279116245bd parent 891254adc8c848cc89a4b907e20dff51126a8c2b Author: Michael Savage <mikejsavage@gmail.com> Date: Sat Dec 24 16:22:33 +0200 ReadStream/WriteStream C array constructors Diffstat:
stream.h | | | 6 | ++++++ |
diff --git a/stream.h b/stream.h @@ -11,6 +11,9 @@ struct ReadStream { ok = true; } + template< size_t N > + ReadStream( const char ( &buf )[ N ] ) : ReadStream( buf, N ) { } + char * cursor; char * one_past_end; bool ok; @@ -24,6 +27,9 @@ struct WriteStream { ok = true; } + template< size_t N > + WriteStream( char ( &buf )[ N ] ) : WriteStream( buf, N ) { } + size_t len() const { return checked_cast< size_t >( cursor - start ); }