Click here to Skip to main content
15,895,606 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: WSO CCC OTD 2020-12-21 - we have a Winner! Pin
musefan20-Dec-20 22:54
musefan20-Dec-20 22:54 
GeneralRe: WSO CCC OTD 2020-12-21 - we have a Winner! Pin
Richard MacCutchan21-Dec-20 2:07
mveRichard MacCutchan21-Dec-20 2:07 
GeneralThat's not the way I remember that scene... Pin
CodeWraith20-Dec-20 14:02
CodeWraith20-Dec-20 14:02 
JokeRe: That's not the way I remember that scene... Pin
Kornfeld Eliyahu Peter20-Dec-20 20:04
professionalKornfeld Eliyahu Peter20-Dec-20 20:04 
GeneralRe: That's not the way I remember that scene... Pin
Johnny J.20-Dec-20 21:04
professionalJohnny J.20-Dec-20 21:04 
GeneralRe: That's not the way I remember that scene... Pin
CodeWraith20-Dec-20 21:44
CodeWraith20-Dec-20 21:44 
PraiseI did it! Huge JSON on 8-bit w/ < 2kB of RAM Pin
honey the codewitch20-Dec-20 12:14
mvahoney the codewitch20-Dec-20 12:14 
GeneralRe: I did it! Huge JSON on 8-bit w/ < 2kB of RAM Pin
Randor 20-Dec-20 13:34
professional Randor 20-Dec-20 13:34 
Hi,

I took a brief look at your project. Looks like you had a lot of fun working on it. I can see that you are using a compiler that supports at least C++14 just by looking at some of the features you are using. But it seems you are mostly writing in just C.

I suspect that you could make your library much simpler by using some C++17 features. You should be able to attach a std::basic_streambuf directly to your allocator buffer. You could then parse it with the C++17 std::basic_string_view.

Try playing around with this:

C++
template <typename T>
class make_stream_buffer_no_copy : public std::basic_streambuf<T, std::char_traits<T> >
{
public:
	make_stream_buffer_no_copy(T* p, std::streamsize n)
	{
		basic_streambuf<T>::setg(p, p, p + n);
		basic_streambuf<T>::setp(p, p + n);
	}

	std::basic_string_view<T> get_string_view()
	{
		return std::basic_string_view<T>(basic_streambuf<T>::pbase(), basic_streambuf<T>::_Gcount);
	}
}


You should be able to attach this directly to your MemoryPool base address.

If you decide to go ALL into C++17 then you could also rewrite MemoryPool with memory_resource[^] Big Grin | :-D

Best Wishes,
-David Delaune
GeneralRe: I did it! Huge JSON on 8-bit w/ < 2kB of RAM Pin
honey the codewitch20-Dec-20 13:39
mvahoney the codewitch20-Dec-20 13:39 
GeneralRe: I did it! Huge JSON on 8-bit w/ < 2kB of RAM Pin
Randor 20-Dec-20 14:04
professional Randor 20-Dec-20 14:04 
GeneralRe: I did it! Huge JSON on 8-bit w/ < 2kB of RAM Pin
honey the codewitch20-Dec-20 14:06
mvahoney the codewitch20-Dec-20 14:06 
GeneralRe: I did it! Huge JSON on 8-bit w/ < 2kB of RAM Pin
Randor 21-Dec-20 11:31
professional Randor 21-Dec-20 11:31 
GeneralRe: I did it! Huge JSON on 8-bit w/ < 2kB of RAM Pin
honey the codewitch21-Dec-20 11:54
mvahoney the codewitch21-Dec-20 11:54 
GeneralRe: I did it! Huge JSON on 8-bit w/ < 2kB of RAM Pin
Randor 21-Dec-20 12:06
professional Randor 21-Dec-20 12:06 
GeneralRe: I did it! Huge JSON on 8-bit w/ < 2kB of RAM Pin
honey the codewitch21-Dec-20 13:03
mvahoney the codewitch21-Dec-20 13:03 
GeneralRe: I did it! Huge JSON on 8-bit w/ < 2kB of RAM Pin
Randor 21-Dec-20 13:47
professional Randor 21-Dec-20 13:47 
GeneralRe: I did it! Huge JSON on 8-bit w/ < 2kB of RAM Pin
honey the codewitch21-Dec-20 13:56
mvahoney the codewitch21-Dec-20 13:56 
JokeWho is Santa’s favorite singer? Pin
Sandeep Mewara20-Dec-20 7:24
mveSandeep Mewara20-Dec-20 7:24 
GeneralRe: Who is Santa’s favorite singer? Pin
W Balboos, GHB20-Dec-20 8:33
W Balboos, GHB20-Dec-20 8:33 
GeneralRe: Who is Santa’s favorite singer? Pin
OriginalGriff20-Dec-20 9:21
mveOriginalGriff20-Dec-20 9:21 
GeneralNew Normal Christmas songs Pin
OriginalGriff20-Dec-20 4:27
mveOriginalGriff20-Dec-20 4:27 
GeneralRe: New Normal Christmas songs Pin
W Balboos, GHB20-Dec-20 4:55
W Balboos, GHB20-Dec-20 4:55 
GeneralRe: New Normal Christmas songs Pin
RickZeeland20-Dec-20 5:38
mveRickZeeland20-Dec-20 5:38 
GeneralRe: New Normal Christmas songs Pin
PIEBALDconsult20-Dec-20 6:16
mvePIEBALDconsult20-Dec-20 6:16 
GeneralRe: New Normal Christmas songs Pin
W Balboos, GHB20-Dec-20 6:34
W Balboos, GHB20-Dec-20 6:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.