[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] [lmi-commits] master a00f295 09/16: Avoid std::ptrdiff_t where
From: |
Vadim Zeitlin |
Subject: |
Re: [lmi] [lmi-commits] master a00f295 09/16: Avoid std::ptrdiff_t where it's excessively wide for 64-bit builds |
Date: |
Fri, 16 Nov 2018 02:20:39 +0100 |
On Thu, 15 Nov 2018 17:37:04 -0500 (EST) Greg Chicares <address@hidden> wrote:
GC> branch: master
GC> commit a00f295b44a06f382ac3f170c09cf12c7dc178cb
GC> Author: Gregory W. Chicares <address@hidden>
GC> Commit: Gregory W. Chicares <address@hidden>
GC>
GC> Avoid std::ptrdiff_t where it's excessively wide for 64-bit builds
GC> ---
GC> ce_product_name.cpp | 18 +++++++++---------
GC> ce_skin_name.cpp | 18 +++++++++---------
GC> mc_enum.tpp | 13 ++++++++-----
GC> 3 files changed, 26 insertions(+), 23 deletions(-)
As all of these changes have the same form, I wonder if it could be useful
to have a convenience function doing this only once. It would certainly be
less universal than lmi::ssize(), but I think it's still common enough to
warrant adding some
template<typename C, typename V>
int lmi::find_index(C const& container, V const& value);
Personally I would even go with
template<typename C, typename V>
std::optional<int> lmi::find_index(C const& container, V const& value);
returning an empty optional if the value is not found, but perhaps I
shouldn't ask for too many things at once...
Regards,
VZ
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [lmi] [lmi-commits] master a00f295 09/16: Avoid std::ptrdiff_t where it's excessively wide for 64-bit builds,
Vadim Zeitlin <=