Похожие чаты

Guys what is difference between trivial and implicity in classes?(like

trivial copy constructor and implicity copy construcy)
I cant undrestand, can someone easy explain with example??

4 ответов

11 просмотров

Implicit is the ones that generated automatically for you. E.g. you have a struct with data, you will have default/copy/move constructors implicitly generated for you. Trivial means it either does nothing (for default constructor) or can be replaced with memcpy (for copy/move constructors). So, for example, in the case of structs above, if the struct has only ints as members, default/move/copy constructors generated will be trivial. If you have a std::string as a member, the struct won't be able to generate trivial constructors because std::string has user-defined constructors.

Caroline- Автор вопроса
Pavel
Implicit is the ones that generated automatically ...

So copy constructor is implicity? Cause it creates default by compiler?

Caroline
So copy constructor is implicity? Cause it creates...

Copy constructor can be generated implicitly if you don't provide user-defined one, or if you do = default on copy constructor declaration. But it can be generated only in case all your members can be copied.

Caroline- Автор вопроса

Похожие вопросы

Обсуждают сегодня

Hey guys, did you see the new announcement about $Fun? 🔥
Filip Murphy
55
А чем вам питонисты не угодили?😂
.
79
Язык Си можно выучить за день? По книжке ANSI C на 230 страниц
Vincent Vegan
29
Привет, запускаю werf в dind в k8s, получаю ошибку на этапе build/beforeSetup: /.werf/stapel/embedded/bin/bash: /.werf/scripts/5898bdfe5214357d3706b879cc8d3d78460fb379607cbd...
florius0
7
пацаны, как-нибудь можно панель задач заблюрить, что она была похожа на kde или винду 7, 11?
В
16
Всем привет, написал код ниже, но он выдает сегфолт, в чем причина? #include <stdio.h> #include <stdlib.h> #include <string.h> struct product { char *name; float price; };...
buzz базз
75
Dim Dim, [02.07.2024 11:07] DB 0x62 Dim Dim, [02.07.2024 11:07] DB 0x66 Dim Dim, [02.07.2024 11:07] кто пояснит что это?
Dim Dim
14
So total 101m burned Today?
Simu
18
Ошибка: segmentation fault (core dumped) Код: pastebin.com/BEsNNSSV Сообщение от компилятора: отсутствует ОС: Arch Linux Ядро: x86_64 Linux 6.9.7-arch1-1 Процессор: Intel Cele...
sec
4
Hi, I can't understand promises in JavaScript and what we should use them for (maybe the teacher didn't teach well XD). Do you have a solution for this? And are promises used...
A
29
Карта сайта