MᏫᎻᎯᎷᎷᎬᎠ
Guys
Anyway to do a static check to the validity of the object after it's moved?!
Like
Object obj;
Object oth = std::move(obj);
obj.say_hi();//error: Instance is not valid
Artöm
MᏫᎻᎯᎷᎷᎬᎠ
MᏫᎻᎯᎷᎷᎬᎠ
as I know
Compile time check is done for constants
MᏫᎻᎯᎷᎷᎬᎠ
Artöm
Pavel
I don't know anything else other than this variant
Artöm
MᏫᎻᎯᎷᎷᎬᎠ
What you mean static?
When moving an invalid object the behavior is undefined, right?!
Same as the static move(if it is exist) when moving with static move(compile time move) the behavior is a compiler error
Artöm
Artöm
And moving smth already moved is ub only for std types, not your own
MᏫᎻᎯᎷᎷᎬᎠ
MᏫᎻᎯᎷᎷᎬᎠ
What makes stds special from my types?!
Artöm
That's all
Artöm
I'll provide an example a bit later
MᏫᎻᎯᎷᎷᎬᎠ
MᏫᎻᎯᎷᎷᎬᎠ
We can steal from a lvalue also🤷🏻♂
Artöm
What makes stds special from my types?!
Std types are described "lightly", standard doesn't cover all usecases. I believe std types are allowed to stay in unspecified state after move. But move can be well specified for your own type
MᏫᎻᎯᎷᎷᎬᎠ
So
Again
I've been asking about whether I can check the validity of the object in the compile time?!
𝕵𝖔𝖘𝖚𝖊
/saved
Artöm
MᏫᎻᎯᎷᎷᎬᎠ
𝕵𝖔𝖘𝖚𝖊
#rules
𝕵𝖔𝖘𝖚𝖊
#ot
Artöm
You can't do it in runtime also
Vladimir
May be someone knows here.
How can I debug signals using vscode? It just doesn't stop on breakpoint if signal catched.
I am debugging it with lldb now but it's not much convenient.
n1coc4cola
hello, i'm writting a mail app and I have problem (of starter):
n1coc4cola
// Loop over the bundle and display the FROM and SUBJECT of each.
int i = 0;
int numEmails = bundle->get_MessageCount();
while (i < numEmails) {
CkEmail *email = bundle->GetEmail(i);
MailButton *mail = new MailButton(this);
mail->setStyleSheet("border-radius: 5px; background-color: rgba(0, 0, 0, 0); margin-bottom: 1px;");
mail->setFixedHeight(70);
mail->setFixedWidth(ui->listView->width() - 12);
QVBoxLayout *mLayout = new QVBoxLayout;
std::cout « email->ck_from() « "\r\n";
QLabel *FROM = new QLabel;
FROM->setText(email->ck_from());
FROM->setStyleSheet("font-size: 15px; color: white; background: #00000000;");
FROM->setMargin(0);
FROM->setFixedHeight(30);
std::cout « email->subject() « "\r\n";
QLabel *SUBJECT = new QLabel;
SUBJECT->setText(email->subject());
SUBJECT->setStyleSheet("font-size: 14px; color: white; background: #00000000;");
SUBJECT->setMargin(0);
SUBJECT->setFixedHeight(20);
std::cout « "--" « "\r\n";
mLayout->addWidget(FROM);
mLayout->addWidget(SUBJECT);
mail->setLayout(mLayout);
QListWidgetItem *item = new QListWidgetItem;
item->setSizeHint(mail->sizeHint());
emit transfer(QString(email->body()));
connect(this, SIGNAL(transfer(QString)), mail, SLOT(handleMessage(QString)));
connect(mail, SIGNAL(Processed(QString)), this, SLOT(MessageFallBack(QString)));
ui->listView->addItem(item);
ui->listView->setItemWidget(item, mail);
delete email;
i = i + 1;
Dima
Mmmm qt
n1coc4cola
I want to name each new MailButton with mail followed by the int i
Vladimir
// Loop over the bundle and display the FROM and SUBJECT of each.
int i = 0;
int numEmails = bundle->get_MessageCount();
while (i < numEmails) {
CkEmail *email = bundle->GetEmail(i);
MailButton *mail = new MailButton(this);
mail->setStyleSheet("border-radius: 5px; background-color: rgba(0, 0, 0, 0); margin-bottom: 1px;");
mail->setFixedHeight(70);
mail->setFixedWidth(ui->listView->width() - 12);
QVBoxLayout *mLayout = new QVBoxLayout;
std::cout « email->ck_from() « "\r\n";
QLabel *FROM = new QLabel;
FROM->setText(email->ck_from());
FROM->setStyleSheet("font-size: 15px; color: white; background: #00000000;");
FROM->setMargin(0);
FROM->setFixedHeight(30);
std::cout « email->subject() « "\r\n";
QLabel *SUBJECT = new QLabel;
SUBJECT->setText(email->subject());
SUBJECT->setStyleSheet("font-size: 14px; color: white; background: #00000000;");
SUBJECT->setMargin(0);
SUBJECT->setFixedHeight(20);
std::cout « "--" « "\r\n";
mLayout->addWidget(FROM);
mLayout->addWidget(SUBJECT);
mail->setLayout(mLayout);
QListWidgetItem *item = new QListWidgetItem;
item->setSizeHint(mail->sizeHint());
emit transfer(QString(email->body()));
connect(this, SIGNAL(transfer(QString)), mail, SLOT(handleMessage(QString)));
connect(mail, SIGNAL(Processed(QString)), this, SLOT(MessageFallBack(QString)));
ui->listView->addItem(item);
ui->listView->setItemWidget(item, mail);
delete email;
i = i + 1;
Don't paste code here - use pastebin or similar.
n1coc4cola
yes
n1coc4cola
ok, sorry
Dima
Well it’s a small code snippet
Vladimir
It's not even monospaced
n1coc4cola
?
n1coc4cola
can you help me?
Vladimir
You just said you have a problem and send bunch of unknown code. Who can help you?
Anonymous
Help guys am trying to print the reverse of 10 numbers using arrays
n1coc4cola
Dima
Explain your problem.
Vladimir
can you help me?
Personally I can't help cause I don't know Qt, but someone may be will.
n1coc4cola
I send data to mail and process data, after it reply data
n1coc4cola
but I use the same name for every objects
Vladimir
Artöm
Lines 12 and 16
Artöm
a -> numbers
n1coc4cola
ifI have two objects, the two will have the name 'mail' the email body of the first will be processed and if I click on the first, after, the second's body is processed, so it'll be the body of the second cause the second was processed in last
n1coc4cola
so, to fix it, I need to name each 'mail' with another name, I want to use the 'i' integer that I used before to name my MailButton, the first will be 'mail0', after, 'mail1'....
n1coc4cola
but I don't know the syntaxe to do it or if there is a trick
n1coc4cola
and I haven't find on the web...
Pavel
Sounds like arrays. Google std::vector, maybe it's what you're looking for.
Pavel
Or std::array if the count is known at compile time.
n1coc4cola
oh, I have a light
n1coc4cola
const char *name = "mail" + i; and MailButton *name = MailButton
n1coc4cola
don't work....
n1coc4cola
i don't understand how to use std::vector
n1coc4cola
finally, have the solution: mail->setObjectName("mail" + QString::number(i));
𝕵𝖔𝖘𝖚𝖊
/saved
𝕵𝖔𝖘𝖚𝖊
#freeprogrammingbooks
Vladimir
#ide
Trader
Hello folks, in the code: 3rd print is getting printed and scanf is not giving option to enter. Please help.
https://pastebin.com/6f6MbUGw
Trader
𝕵𝖔𝖘𝖚𝖊
/get best-book
𝕵𝖔𝖘𝖚𝖊
/get best
𝕵𝖔𝖘𝖚𝖊
/get cbook
𝕵𝖔𝖘𝖚𝖊
/get cppbook
𝕵𝖔𝖘𝖚𝖊
/get gcc9
𝕵𝖔𝖘𝖚𝖊
/get ide
𝕵𝖔𝖘𝖚𝖊
/get learn