Maybe it was a subtle way to say “macaroni and cheese is good anyway”
Web & Software developer. I also love pizza🍕, cats🐱, and computers🖥️.
⚠ The Astolfo pfp is just temporal! ⚠
🎵 𝘖𝘯𝘦 𝘥𝘢𝘺, 𝘐 𝘩𝘰𝘱𝘦 𝘐’𝘮 𝘴𝘰𝘮𝘦𝘰𝘯𝘦 𝘺𝘰𝘶’𝘥 𝘮𝘪𝘴𝘴. 🎶
Maybe it was a subtle way to say “macaroni and cheese is good anyway”
JavaScript is crazy. While you are learning React.js or Vue.js you are learning Webpack, Rollup or Vite.js even without your consent :skull:
Apparently it is impossible for this kind of functions to be defined as friends of classes:
template <typename T>
auto do_something(T &t) -> decltype(t.private_msg);
class Foo
{
private:
const char *private_msg = "You can't touch me!";
friend auto do_something<>(Foo &f) -> decltype(f.private_msg); // Error!
};
template <>
auto do_something<Foo>(Foo &f) -> decltype(f.private_msg) // Error!
{
return f.private_msg; // Error!
}
After trying different combinations, it seems that I managed to get it working with the condition the whole template are considered friends of the class. I don’t know if I should consider it a language problem, but it seems that way, since the template restrictions (in this case) are minor.
template <typename T>
auto do_something(T &t) -> decltype(t.private_msg);
class Foo
{
private:
const char *private_msg = "You can't touch me!";
template <typename T>
friend auto do_something(T &t) -> decltype(t.private_msg); // This works fine!
};
template <>
auto do_something<Foo>(Foo &f) -> decltype(f.private_msg)
{
return f.private_msg;
}
Do you think I found an error in the language?
This proposal is meaningless bullshit. I can’t believe we are one of the the oldest species on earth and they keep coming up with such ridiculous ideas. This is a NO from me for this ridiculous proposal.