[syncstream.syncbuf.virtuals]

# 31 Input/output library [[input.output]](./#input.output)

## 31.11 Synchronized output streams [[syncstream]](syncstream#syncbuf.virtuals)

### 31.11.2 Class template basic_syncbuf [[syncstream.syncbuf]](syncstream.syncbuf#virtuals)

#### 31.11.2.5 Overridden virtual functions [syncstream.syncbuf.virtuals]

[ð](#lib:sync,basic_syncbuf)

`int sync() override;
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L12883)

*Effects*: Records that the wrapped stream buffer is to be flushed[.](#1.sentence-1)

Then, if *emit-on-sync* is true, calls emit()[.](#1.sentence-2)

[*Note [1](#note-1)*:

If *emit-on-sync* is false,
the actual flush is delayed until a call to emit()[.](#1.sentence-3)

â *end note*]

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L12892)

*Returns*: If emit() was called and returned false,
returns -1; otherwise 0[.](#2.sentence-1)
