|
Android being created by Google probably has something to do with it
|
|
|
|
|
I'm writing a little bit of code to represent modest in memory JSON trees on 32-bit Arduino compliant platforms using the Arduino SDK.
My first plan was to at least prototype that using something like std::unordered_map but lo and behold, you can't use unordered_map with incomplete types. With GCC's std::map you can, for some dumb reason. It's totally possible to implement unordered_map to work with incomplete types, and boost even does it, but I can't use the boost framework with this thing.
Consider what a structure representing JSON "object" actually is:
It's an unordered hashtable with string keys, that point to a union of possible types, one of which is an unordered hashtable with string keys that point to a union of possible types, one of which is an unordered... you get the idea.
Basically the map needs to have itself as right hand side members. This is pretty standard for representing JSON in any language.
This is also fairly commonplace for representing tree structures.
So it just floors me that neither Microsoft nor the GCC team have implemented unordered_map in a way that's (at least I consider to be) proper. This use case is so common!
I can kluge around it supposedly with std::unique_ptr but I'm running into more problems there.
At this point I'm about ready to write my own.
Normally I *love* the Standard Template Library. It's the perfect addition to bring C++ from a mid level language to a (slightly) higher level language, and it's nice that so much of the guts are able to be reconfigured and overridden but when it fails, it fails *spectacularly* and then you are as much on your own as when you try to do something in classic VB outside of its ecosystem. It's a really frustrating thing about an otherwise lovely framework.
Real programmers use butterflies
|
|
|
|
|
Well,
You could take whatever issue you are having to Stephan since he is the guy maintaining Microsoft’s STL implementation.
Btw, in the old days with Visual Studio .NET 2002[^]... Microsoft had it's own standard template library implementation that did all sorts of custom things... one of which was allowing to check iterators against NULL. I can't remember all of the customizations off the top of my head... but there were many... and they were not well received by the community.
Shortly after that the Visual Studio team licensed the STL library from P.J. Plauger[^] and used that for over a decade.
|
|
|
|
|
It's not just a microsoft issue. It seems there's nothing in the standard to prevent the maps from being implemented this way. GCC does it too.
Real programmers use butterflies
|
|
|
|
|
honey the codewitch wrote: there's nothing in the standard to prevent the maps from being implemented this way Ok, then write up your proposal and submit your paper to the ISO C++ committee.
|
|
|
|
|
I just want to make a JSON lib tho.
Real programmers use butterflies
|
|
|
|
|
"A lovely framework". That's like saying, I have a comfortable straight jacket.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Normally I'd agree. Privately I see the STL as part of the language. They've just separated that part into something you can modify. So I give it some leeway. All languages come with some sort of framework implicit in their design.
Real programmers use butterflies
|
|
|
|
|
No, STL just standardizes the way the hard shit is implemented. It doesn't make things easier, and wasn't designed to do so.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Well it certainly makes it easier for me to do things like- "Oh I need a container with these particular performance characteristics - I'll just use this"
It's certainly easier than designing lists, vectors, and maps myself.
Real programmers use butterflies
|
|
|
|
|
They say that "Women are from Venus, Men are from Mars" – but is that just Venus envy?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Why don't you Tellus?
Anything that is unrelated to elephants is irrelephant Anonymous
- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944
- Never argue with a fool. Onlookers may not be able to tell the difference. Mark Twain
|
|
|
|
|
Ares a question about that. Perhaps some literature on mythology could Bacchus up on this? Until then, let the Fates determine what will be-phallus.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Insightful, did you planet that way?
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
No - it was just buy-in to a plutocracy.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Nice, thanks for Charon that!
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
Never let it be said I Saturn my backside whilst there were was work to be done!
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
There's a planetary backside joke in there somewhere, for now I have no comet.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
Now, putting asteroid any preconceived notions, I had thought this thread was picked to the bone, but it seems to be getting meteor and meteor.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
I'm surprised Chris doesn't Titan his grip on the Lounge, too many bad puns might cause a Ceres problem.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
That rings true. It might be a good for the Monday Polaris that a bit too much? Nebula mind - he'll figure something out.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Men can't handle that much IO.
|
|
|
|
|
He couldn't see that well.
“Give a man a program, frustrate him for a day. Teach a man to program, frustrate him for a lifetime.”
|
|
|
|
|
Horrid pun. You'll be punished and receive forty splashes.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
My friend keeps saying "Cheer up man it could be worse, you could be stuck underground in a hole full of water".
I know he means well...
Anything that is unrelated to elephants is irrelephant Anonymous
- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944
- Never argue with a fool. Onlookers may not be able to tell the difference. Mark Twain
|
|
|
|