I was working a little on this code:
#include <type_traits>
template<typename T, typename T2>
constexpr bool Assignable = std::is_assignable<T&,T2>::value;
template<typename T>
void test() {
static_assert(Assignable<T, std::string>, "hello1");
static_assert(Assignable<T&, std::string>, "hello2");
}
int main()
{
test<int>();
}
I wonder what static_assert(Assignable<T&, std::string>, "hello2");
checks exactly?
Since Assignable
already uses T&
inside, calling static_assert(Assignable<T, std::string>, "hello1");
should check if reference to type T
is assignable with std::string
. I wonder what T&
inside static_assert(Assignable<T&, std::string>, "hello2");
does?
Regards