Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6874797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:14:21+00:00 2026-05-27T04:14:21+00:00

I was happy for the standard library to get a to_string function, but now

  • 0

I was happy for the standard library to get a to_string function, but now I’m in WTF mode. First of all why isn’t this templated, second of all if it is not a template on return value then why in the world they don’t have to_u16string() and to_u32string() functions.

I know that there is boost lexical cast, but I’m curious to know if there is a standard way to get what I want without manually writing these functions?

EDIT: to make matters worse boost 1.46 also dislikes u16string 🙁

boost::lexical_cast<u16string>(22.44);

terminate called after throwing an instance of
‘boost::exception_detail::clone_impl

‘ what(): bad lexical cast: source type value could not be interpreted as target

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:14:22+00:00Added an answer on May 27, 2026 at 4:14 am

    Relax and take a deep breath before you collapse.

    It all makes perfect sense. to_string and to_wstring use sprintf/wsprintf. There is nothing in the language that crosses the bridge between agnostic narrow/wide encoding and the UTF encodings, so there simply does not exist a standard library facility to produce UTF-encoded strings. The new UTF-facilities allow you to store UTF-encoded strings and transcode among them, but there is no way to encode a system-specific encoding to a UTF-encoding without the help of an extra library.

    How would those “20 lines of code” look like that you propose? Include floating point numbers, please.

    (Here are my standard question links on the subject: #1, #2, #3)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're pretty happy with SVN right now, but Joel's tutorial intrigued me. So I
Happy New Year. I have a bunch of SOAP Web Services. They all have
I'm writing a small Ruby command-line application that uses fileutils from the standard library
Basically, I want to get an update of the standard command-line subversion client for
I noticed a very curious behavior that, if standard, I would be very happy
I've been using SVN for some time now, and am pretty happy with how
The standard way to create an object in Objective-C looks like this: MyClass* object
When I create my own non-standard path for library files (say, ~/lib) I can
I've alluded to this project before, in this question, but the scope of redesign
I'm working on converting my standard PHP project to OOP but I ran into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.