« first day (1059 days earlier)      last day (2018 days later) » 

11:53
explicit Stream::operator bool() const noexcept { return static_cast<bool>(stream); }
MSVC says operator bool cannot be declared with 'explicit' specifier
stream is a std::shared_ptr and the function signatures in the class declaration and the method definition match.
12:09
struct S {
    explicit operator bool() const noexcept;
};

explicit S::operator bool() const noexcept {
     return true;
}
gives it
I had to remove explicit from the definition as it isn't a part of the function signature.
12:47
@Yashas which version?
nwp
nwp
Doesn't really matter. Very likely happens in all of them.
Not sure why godbolt doesn't have older msvcs.
@nwp according to CPPref it's implemented in 19.22
and that's 19.20
clang and GCC in theory should work if the standard is set to 2a
ah apparently it's a declaration only thing anyway
nwp
nwp
Yeah, that seems like something different.
I'm gonna have to screw around with explict for my game.
 
3 hours later…
16:22
@Mgetz 19.16
 
2 hours later…
18:25
parent = std::make_shared<tensor_type>(sizes[0], sizes[1], sizes[2], sizes[3]);
sizes is std::array<tensor_type::size_type, tensor_type::rank>
is there a neat way to unpack the array values into arguments?
something like the star operator in python which can be used to unpack tuples
18:38
@Yashas templates, and std::integer_sequence
18:50
in C++11
@Yashas no idea
I could roll out my own std::integer_sequence and other utilities but that's a bit too much.
19:08
that usually needs compiler support
unless you want to risk stack overflow or long compile times
 
2 hours later…
21:13
template<typename T>
class X
{
public:
    X(T t) : t{std::move(t)}
private:
    T t;
};

template<typename U>
auto make(U&& u) { return X{std::forward<U>(u)}; }
If I write that code above, and I write make(whatever), could I end up having a X<some type&> and being storing only references instead of storing values?
nwp
nwp
Pretty sure yes.
Use std::remove_reference_t to avoid that.
21:46
@nwp In std::make_pair's page (en.cppreference.com/w/cpp/utility/pair/make_pair) I saw they are using std::decay_t, should I use that or I could just use std::remove_reference_t?

« first day (1059 days earlier)      last day (2018 days later) »