std::to_wstring

Header: <string>

Converts a numeric value to std::wstring.

# Declarations

std::wstring to_wstring( int value );

(since C++11)

std::wstring to_wstring( long value );

(since C++11)

std::wstring to_wstring( long long value );

(since C++11)

std::wstring to_wstring( unsigned value );

(since C++11)

std::wstring to_wstring( unsigned long value );

(since C++11)

std::wstring to_wstring( unsigned long long value );

(since C++11)

std::wstring to_wstring( float value );

(since C++11)

std::wstring to_wstring( double value );

(since C++11)

std::wstring to_wstring( long double value );

(since C++11)

# Parameters

# Return value

A wide string holding the converted value.

# Example

#include <iostream>
#include <string>
 
int main()
{
    for (const double f : {23.43, 1e-9, 1e40, 1e-40, 123456789.0})
        std::wcout << "std::wcout: " << f << '\n'
                   << "to_wstring: " << std::to_wstring(f) << "\n\n";
}

# See also