fs/io/BufferedOutputStream: add WithBufferedOutputStream()
This commit is contained in:
parent
56bded07b1
commit
5b8ff61799
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2014-2018 Max Kellermann <max.kellermann@gmail.com>
|
* Copyright 2014-2019 Max Kellermann <max.kellermann@gmail.com>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@ -88,4 +88,13 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename F>
|
||||||
|
void
|
||||||
|
WithBufferedOutputStream(OutputStream &os, F &&f)
|
||||||
|
{
|
||||||
|
BufferedOutputStream bos(os);
|
||||||
|
f(bos);
|
||||||
|
bos.Flush();
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user