Jump to content

Recommended Posts

  • Active+ Member

 

In short, when parsing DB data, functions like std::stoi are used. These throw exceptions if there is an error, but nobody wraps them in a try-catch block.

Without getting into too much technical detail, this approach gives you a noexcept guarantee. It prevents potential terminate issues that happen when an exception isn't caught

Parser: https://gist.githubusercontent.com/mberk-yilmaz/74966194c9a72d242cb6adca119ccab6/raw/2aa128c07582c717a2752733b3ef479b16ab1f08/safe_parsing.hpp

Demo: https://godbolt.org/z/TYsqsva4o

Software Engineer | Low-Latency C++

Link to comment
https://metin2.dev/topic/34231-c20-type-safe-string-parsing-wrapper/
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.