lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Cating doubles to enums


From: Greg Chicares
Subject: Re: [lmi] Cating doubles to enums
Date: Tue, 6 Nov 2018 10:36:54 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0

On 2018-11-05 22:42, Vadim Zeitlin wrote:
> On Mon, 5 Nov 2018 22:31:57 +0000 Greg Chicares <address@hidden> wrote:
[...]
> GC> template<typename T>
> GC> void product_database::query_into(T& dst, e_database_key k) const
> GC> {
[...snip ten lines...]
> GC> }
> GC> 
> GC> which falls just short of my threshold for adding a unit test module.

No unit-test module need be added, however, as one already exists:
'input_test.cpp', which notes that...

// Class product_database might appear not to belong, but it's
// intimately entwined with input.

In fact, it already tested other "query" functions, though that was
difficult to discern due to the C++98 syntax:

std::bind((void (product_database::*)(std::vector<double>&, e_database_key) 
const)&product_database::Query,           &db, v, DB_MaturityAge)

>  I don't have anything important to say other than that however and I
> really like how nice and clear this code is in C++17, especially knowing
> what would have been needed to do the same thing without if-constexpr.

Yes, and similarly `git show d0714fdb` reveals that the rigmarole above means:

  [&db, &v] {db.Query(v, DB_MaturityAge);};



reply via email to

[Prev in Thread] Current Thread [Next in Thread]