Anonymous
NTTP should have structural type
Anonymous
cNTTP should have literal type with additional constraints (which is a special case of structural type)
olli
well yeah sure, I was considering the second paragraph as a statement and question of its own. And for a type to be considered literal it does not need to have public members.
Anonymous
Definitely
MᏫᎻᎯᎷᎷᎬᎠ
Where did it say the part about public and not mutable?
Here
In the limitations explained section:
https://ctrpeach.io/posts/cpp20-class-as-non-type-template-param/
The blog just guessed the reason and wasn't sure about it
And here also
https://en.cppreference.com/w/cpp/language/template_parameters
Anonymous
Well the reason probably is that compiler have to cache instantiated templates
Anonymous
And the compiler should know how to compare template arguments
MᏫᎻᎯᎷᎷᎬᎠ
Anonymous
And the easiest way to do it right now is to constraint to all public members
MᏫᎻᎯᎷᎷᎬᎠ
Can't the compiler see private data or what? Joke
Anonymous
What is that?
template <typename T>
void foo() {}
&foo<int> == &foo<int>
Anonymous
Anonymous
It's more likely to say "your members must be public so you should not keep internal state so anyone can break it of we just make your members public"
Anonymous
Maybe it doesn't make any sense
Anonymous
But compiler cannot rely to user-provided operator==
MᏫᎻᎯᎷᎷᎬᎠ
Yeah
Anonymous
So for example if you make all of std::string's member public you cannot really compare two strings member by member
Anonymous
publicity of member may also mean "all your state must be directly in an object"
Anonymous
I think they will "unconstraint" it in future standards when they will find the way to do it properly
MᏫᎻᎯᎷᎷᎬᎠ
Yup
Andrea
hello I would need help on a game that I am playing with curses in c, using processes and pipes, sorry for the English but I am Italian
j
when we are passing a vector to a funcition, why do we have to specify an & at the paramenters of the function? shouldnt we put an * instead?
Anonymous
Hi,i want to know how to write choose menu number 1 if the value r=4,i=4,v=2 in the code block?
King Phyte 🐍
Anonymous
How can I send a function as a paramter to another one?
MainWindow::GetData(QUrl("http://google.com"), &MainWindow::ShowPost);
Here is my function:
void MainWindow::GetData(QUrl url, void (* callback)(QNetworkReply * reply))
But it returns error
Vlad
Anonymous
std::function
Can you make an example with the things that I pasted? 😁
Anonymous
Vlad
Anonymous
Type mismatch perhaps
Hmmm, I think you're right. I'm trying to receive a pointer to a global function, but I send a class method address to that pointer. What am I supposed to do to fix this issue?
Vlad
Vlad
Kinda hacky but should work
Anonymous
Vlad
Thanks. Got it
But you gotta remember that capture by the reference is dangerous for a callback
Anonymous
Good morning
nandha
Ya..I'm agree
Артём
Can I forbid to bind a reference to my object?
Артём
I mean, how can I define such class, to whose object cannot be bound a reference?
Roshan
Can someone give a brief idea of what is STL and all its components?
Roshan
Roshan
I am learning STL and wanted to just know how big it is.
Anonymous
Anonymous
Google for types of member functions in C++
Anonymous
But as Vlad advised you, I'd change type to std::function and pass the lambda as the callback
Anonymous
Anonymous
سلطان
can anyone recommand for my a plan for advanced C/C++ program because i need learn more 🤘🏻
Anonymous
Anonymous
2.
سلطان
thanks👍🏻❤️
Xudoyberdi
Anonymous
Anonymous
Blue
Why i cant run
How are we supposed to know if we dont see the error message?
Anonymous
King Phyte 🐍
Why i cant run
I did say I was assuming a lot of things
So maybe you would show the error message and or the code first
Soldier_OF_Mahdi1998
Hi there :) ahm sorry to interrupt you but may you check my codes to see why it goes on and on without taking user input ?
in my function i added cin but code goes without taking userinput
Anonymous
https://pastebin.com/MCDfnJ09
Anonymous
YUSUF
Why i cant run
If(r==4&&i==4&&v==2)
{
} now this can run
Roshan
What happens when I do this?
Stringstream ss;
ss << str1;
ss >> a;
ss << str2; // What happens here??
ss >> b;
ברני
Hey stupid math question that I forgot... How do I devide 2 numbers with minus only? 😞(on C)
Anonymous
ברני
A_Z
Hi Folks!
Please suggest some resources to learn C Programming along with basic Projects.
Thanks Folks.
Roshan
Roshan
For the numbers that are divisible.
Артём
I tried to redefine operator& (getting address of) as deleted, so I only prevent from creating pointers to my objects. Creating references seems to work another way, not like through getting address of var.
Anonymous
OMG
Anonymous
I haven't looked for English