mirror of
https://github.com/allankoechke/soci.git
synced 2026-11-30 10:58:24 +00:00
Make ssize() return ssize_t in pre-C++20 mode too
The return type of ssize() was inconsistent: it returned ssize_t with C++20 but int otherwise. Change the fallback function to conform to the standard one.
This commit is contained in:
@@ -24,13 +24,17 @@ using std::ssize;
|
||||
|
||||
#else // !C++20
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
using ssize_t = std::make_signed<std::size_t>::type;
|
||||
|
||||
// Provide simple implementation of C++20 std::ssize() sufficient for our needs
|
||||
// ourselves.
|
||||
|
||||
template <typename C>
|
||||
constexpr int ssize(C const& c)
|
||||
constexpr ssize_t ssize(C const& c)
|
||||
{
|
||||
return static_cast<int>(c.size());
|
||||
return static_cast<ssize_t>(c.size());
|
||||
}
|
||||
|
||||
#endif // C++20/!C++20
|
||||
|
||||
Reference in New Issue
Block a user