Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Is there a non-allocating String similar to a string_view in NTL?
Re: Is there a non-allocating String similar to a string_view in NTL? [message #58464 is a reply to message #58463] Sat, 28 May 2022 09:07 Go to previous messageGo to previous message
jjacksonRIAB is currently online  jjacksonRIAB
Messages: 221
Registered: June 2011
Experienced Member
Oblivion wrote on Sat, 28 May 2022 08:41
Quote:
I have a COW database that uses mmap and the String type seems to either allocate or move when I would like to just have a const pointer/len to memory itself. Is there anything in NTL that can do this?


How about Upp::MemReadStream? If I understand you correctly, this seems to be what you need.

Best regards,

Oblivion


Nice. How would that work though for deserialization without copy?

I try:

#include <Core/Core.h>

using namespace Upp;

CONSOLE_APP_MAIN {
    const char *test = "this is a test";
    MemReadStream ms(test, strlen(test));
    
    String test2;
    ms % test2;
    
    Cout() << test2;
}


And the result is empty. GetLine returns a new String, Put(Cout()) is also empty.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Relocated Upp Folder - Missing Packages
Next Topic: No mouse hover tip?
Goto Forum:
  


Current Time: Sun May 12 07:54:31 CEST 2024

Total time taken to generate the page: 0.02520 seconds