« first day (2025 days earlier)      last day (834 days later) » 

2:48 PM
@Mikhail depends on what you're doing
 
3:20 PM
if you're optimizing for long build-times then std::visit is fine
 
I basically only use it when I need to use literally the same code for two different types and I don't really want to risk UB.
 
 
4 hours later…
7:39 PM
template <char... Bits>
bra operator"" _bra() {
how do you read this ?
 
well it's a user defined literal operator
buuut what it's trying to do is impossible to tell as posted
 
template <char... Bits>
ket operator"" _ket() {
    constexpr idx n = sizeof...(Bits);
    constexpr char bits[n + 1] = {Bits..., '\0'};
    qpp::ket q = qpp::ket::Zero(static_cast<idx>(std::llround(std::pow(2, n))));

    // EXCEPTION CHECKS

    // check valid multi-partite qubit state
    for (idx i = 0; i < n; ++i) {
        if (bits[i] != '0' && bits[i] != '1')
            throw exception::OutOfRange(R"xxx(qpp::operator "" _ket())xxx");
    }
    // END EXCEPTION CHECKS

    idx pos = std::stoi(bits, nullptr, 2);
I've never seen that notations: char... Bits, operator""
what am I missing
 
well that's just a parameter pack
 
7:44 PM
wow
 
it's actually a really powerful set of tools
 
7:57 PM
thank you
 

« first day (2025 days earlier)      last day (834 days later) »