Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update string.hpp #14

Merged
merged 1 commit into from
Apr 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions stdex/include/string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace stdex
void strtold(); // dummy
void wcstold(); // dummy
float swprintf(...);
int snprintf(...);
float snprintf(...);
}
using namespace std;
using namespace std_dummy;
Expand Down Expand Up @@ -124,7 +124,7 @@ namespace stdex
using std_cpp11::wcstoull;
using std_cpp11::strtold;
using std_cpp11::wcstold;
using std_cpp11::snprintf;


struct _strtoll_present
{
Expand Down Expand Up @@ -156,11 +156,6 @@ namespace stdex
static const bool value = sizeof(_wcstold_tester(&wcstold)) == sizeof(_yes_type);
};

struct _snprintf_present
{
static const bool value = sizeof(_snprintf_tester(&snprintf)) == sizeof(_yes_type);
};

using std_cpp11::swprintf;

_yes_type _has_4arg_swprintf_tester(int);
Expand All @@ -171,6 +166,18 @@ namespace stdex
static const bool value =
sizeof(_has_4arg_swprintf_tester(swprintf(_declptr<wchar_t>(), 42, _declptr<wchar_t>(), 0 ))) == sizeof(_yes_type);
};

using std_cpp11::snprintf;

_yes_type _has_4arg_snprintf_tester(int);
_no_type _has_4arg_snprintf_tester(float);

struct _has_4arg_snprintf
{
static const bool value =
sizeof(_has_4arg_snprintf_tester(snprintf(_declptr<char>(), 42, _declptr<char>(), 0 ))) == sizeof(_yes_type);
};

}

template<bool _IsSigned>
Expand Down Expand Up @@ -313,7 +320,7 @@ namespace stdex
inline
void _sprintf4_std_impl(char* buffer, std::size_t len, const char* format, _ArgT arg)
{
_sprintf_impl<string_detail::_snprintf_present::value>::call(buffer, len, format, arg);
_sprintf_impl<string_detail::_has_4arg_snprintf::value>::call(buffer, len, format, arg);
}

template<>
Expand Down