Commit 8408ac4c authored by SR_team's avatar SR_team 💬

fix unique_ptr usage

parent 877a4e87
......@@ -9,15 +9,16 @@
#include <cstring>
#include <locale>
#include <codecvt>
#include <windows.h>
template<typename TChar> class SRStringBase {
public:
template<typename... Args>
static std::basic_string<TChar> sprintf( std::basic_string_view<TChar> format, Args... args ) {
size_t size = snprintf( nullptr, 0, format.data(), args... ) + 1;
auto buf = std::make_unique<char>( size );
size_t size = snprintf( nullptr, 0, format.data(), args... ) + 1;
auto buf = std::make_unique<char[]>( size );
snprintf( buf.get(), size, format.data(), args... );
return std::basic_string<TChar>( buf.get(), buf.get() + size - 1 );
return std::basic_string<TChar>( buf.get() );
}
template<typename... Args>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment