ENH: add OListStream::swap(DynamicList<char>&)
- allows full recovery of allocated space, not just addressable range. This can be particularly useful for code patterns that repeatedly reuse the same buffer space. For example, DynamicList<char> buf(1024); // some loop { OListStream os(std::move(buf)); os << ... os.swap(buf); } Can read back from this buffer as a second operation: { UIListStream is(buf); is >> ... }
Showing
- applications/test/OListStream/Test-OListStream.C 10 additions, 2 deletionsapplications/test/OListStream/Test-OListStream.C
- src/OpenFOAM/db/IOstreams/memory/IListStream.H 2 additions, 2 deletionssrc/OpenFOAM/db/IOstreams/memory/IListStream.H
- src/OpenFOAM/db/IOstreams/memory/OListStream.H 35 additions, 11 deletionssrc/OpenFOAM/db/IOstreams/memory/OListStream.H
- src/OpenFOAM/db/IOstreams/memory/UIListStream.H 3 additions, 3 deletionssrc/OpenFOAM/db/IOstreams/memory/UIListStream.H
- src/OpenFOAM/db/IOstreams/memory/memoryStreamBuffer.H 9 additions, 5 deletionssrc/OpenFOAM/db/IOstreams/memory/memoryStreamBuffer.H
Please register or sign in to comment