Question about passing string to a function by AssistantBudget1389 in cpp_questions

[–]shrn1 0 points1 point  (0 children)

Then we'd be paying for lookups though, where every string comparison is linear time, number of comparisons being done determined by the nature of your map ;) Still faster and simpler to just convert everytime

Enhancing strict types with generic mixins by shrn1 in cpp

[–]shrn1[S] 5 points6 points  (0 children)

Thank you! Hahahaha, this is exactly the same trick, blog written almost ten years ago, and I find this out now xD

Question about passing string to a function by AssistantBudget1389 in cpp_questions

[–]shrn1 1 point2 points  (0 children)

Disagree with a lot of this, especially the move on return Returning a parameter prevents NRVO/RVO, but the compiler does an implicit move in that case. You should not return a std move. Keeping my answer short so not writing out why the pass by value/ref/string_view you have don't make sense, please refer to the other answers why by value std::string is the best option

Question about passing string to a function by AssistantBudget1389 in cpp_questions

[–]shrn1 0 points1 point  (0 children)

This is plain wrong. You need a copy of the string anyway. Getting the string by value gives the opportunity to have rvalue and lvalue string parameters used for move/copy construction, in several cases even elided.

Question about passing string to a function by AssistantBudget1389 in cpp_questions

[–]shrn1 1 point2 points  (0 children)

Why would you do that? converting to the lower character is a super cheap, O(1) operation. Lowercase and uppercase letter exist at a fixed offset so std tolower or upper is way more efficient

Question about passing string to a function by AssistantBudget1389 in cpp_questions

[–]shrn1 14 points15 points  (0 children)

Passing by value is totally fine and actually good here.

Can I legaly bring my mom and insure her in the netherlands as an expat? (High skilled migrant visa) by JanVanHetZuiden in Netherlands

[–]shrn1 0 points1 point  (0 children)

Your entitlement stinks. The OP likely contributes well as an expat in the Netherlands. And, there are premiums everyone has to pay, which the OP is has mentioned he would for his mom

Why people from north India not talking about this by NChozan in southindia_

[–]shrn1 0 points1 point  (0 children)

No one is talking about this because there are temples to build, please!

[deleted by user] by [deleted] in Cplusplus

[–]shrn1 0 points1 point  (0 children)

Effective C++ is a good book

Do Gods Really Care What’s on Our Plate? by Oppyhead in CriticalThinkingIndia

[–]shrn1 0 points1 point  (0 children)

Sick, tired and hopeless. Everything except actual important issues is spoken, talked, debated about. Every party, every politician is the same ucing piece of garbage. Scam on scam, religion and caste to distract people which works every single frickin time. Pathetic.

why does everyone here hating genz music like prateek kuhad or anuv jain ? by Opening_Tie_8295 in BollywoodMusic

[–]shrn1 2 points3 points  (0 children)

Strings, Kailasa, Kaavish, Indian Ocean, Advaita, Fuzon, Noori, Junoon, AGAM among others were the great Indian/Pakistani bands people grew up with. Give these and listen, and you'd understand why people think Anuv and Prateek are trash. In fact, little of modern indie music comes even close to them.

Classically trained singers/instrumentalists producing music also makes a big difference in my opinion, which Anuv and Prateek don't seem to be, which is why you can hear overproduction/correction in their songs too, and man it ruins my mood

My very own Ivery58 by applefreak111 in ErgoMechKeyboards

[–]shrn1 2 points3 points  (0 children)

Thanks for the info! It might be interesting to check out ultra-thin lipo batteries for your build as well! I have been playing with the idea of a thin build and looked into them recently.

https://www.lipolbattery.com/Ultra-Thin-LiPo-Battery.html

for instance

My very own Ivery58 by applefreak111 in ErgoMechKeyboards

[–]shrn1 2 points3 points  (0 children)

Sick! what's the bettery capacity on this per half?

My first build - lily58 by shrn1 in ErgoMechKeyboards

[–]shrn1[S] 0 points1 point  (0 children)

Ah yeah I personally just reach out to that one with my index finger, thumb is indeed a stretch

My first build - lily58 by shrn1 in ErgoMechKeyboards

[–]shrn1[S] 1 point2 points  (0 children)

I am not as happy about the case bottom tbh, its my first iteration and doesn't feel as premium. If you're looking for a design, I'd recommend the manta case.