mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-15 20:31:16 +08:00
Removed templated variables
Also fixed tabs to spaces. Used github editor, can update later if there was a syntax error.
This commit is contained in:
parent
fb84f9b4a9
commit
d207a26638
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013-2015, Roland Bock
|
* Copyright (c) 2013-2017, Roland Bock, Aaron Bishop
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
@ -40,27 +40,21 @@ namespace sqlpp
|
|||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
template<class DbResult, class = void>
|
template<class DbResult, class = void>
|
||||||
struct result_has_size : std::false_type {};
|
struct result_has_size : std::false_type {};
|
||||||
|
|
||||||
template<class DbResult>
|
template<class DbResult>
|
||||||
struct result_has_size<DbResult, void_t<decltype(std::declval<DbResult>().size())>>
|
struct result_has_size<DbResult, void_t<decltype(std::declval<DbResult>().size())>>
|
||||||
: std::true_type {};
|
: std::true_type {};
|
||||||
|
|
||||||
template<class DbResult>
|
template<class DbResult, class = void>
|
||||||
constexpr bool result_has_size_v = result_has_size<DbResult>::value;
|
struct result_size_type { using type = void; };
|
||||||
|
|
||||||
template<class DbResult, class = void>
|
template<class DbResult>
|
||||||
struct result_size_type { using type = void; };
|
struct result_size_type<DbResult, void_t<decltype(std::declval<DbResult>().size())>>
|
||||||
|
{
|
||||||
template<class DbResult>
|
using type = decltype(std::declval<DbResult>().size());
|
||||||
struct result_size_type<DbResult, void_t<decltype(std::declval<DbResult>().size())>>
|
};
|
||||||
{
|
|
||||||
using type = decltype(std::declval<DbResult>().size());
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class DbResult>
|
|
||||||
using result_size_type_t = typename result_size_type<DbResult>::type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename DbResult, typename ResultRow>
|
template <typename DbResult, typename ResultRow>
|
||||||
@ -165,12 +159,12 @@ namespace sqlpp
|
|||||||
_result.next(_result_row);
|
_result.next(_result_row);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Size = detail::result_size_type_t<DbResult>>
|
template<class Size = typename detail::result_size_type<DbResult>::type>
|
||||||
Size size() const
|
Size size() const
|
||||||
{
|
{
|
||||||
static_assert(detail::result_has_size_v<DbResult>, "Underlying connector does not support size()");
|
static_assert(detail::result_has_size<DbResult>::value, "Underlying connector does not support size()");
|
||||||
return _result.size();
|
return _result.size();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace sqlpp
|
} // namespace sqlpp
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user