Detailed notes on C + + operators

C + + operators 1, Arithmetic operator Unary operators (monocular) have the highest priority, followed by multiplication, division and remainder, and finally addition and subtraction. And it has left associativity, that is, when the priorities are the same, it is calculated from left to right. Monocular: + or - (unary positive / negativ ...

Posted by q1234ask on Fri, 02 Sep 2022 21:39:06 +0300

Notes on interfaces, polymorphism, inner classes, and more!

1. Static The static keyword can modify member variables and member methods basic concept: static member belongs to class It can be accessed through the class name, and is generally modified with public classname.propertyname; classname.methodname(); can also be accessed by object name (not recommended) Memory explanation: Sta ...

Posted by ess14 on Wed, 31 Aug 2022 03:28:19 +0300

Detailed explanation and implementation of c + + callback function (lambda)

A callback function is a function that is passed as a parameter. In C language, callback function can only be implemented by function pointer. In C + + language, you can also use imitative function or anonymous function. The use of callback function can greatly improve the efficiency of programming, which makes it widely used in modern programm ...

Posted by darkhappy on Mon, 22 Aug 2022 02:50:43 +0300

Item 10: Prefer scoped enums to unscoped enums

There is a basic principle that declaring a name in curly brackets restricts the visibility of the name to the scope of the curly brackets. However, enumerations declared in the C++98 style enum do not follow this principle. The visibility of these names extends to the scope containing the enumeration, meaning that the same name cannot be conta ...

Posted by Xil3 on Fri, 19 Aug 2022 03:29:34 +0300

2022 Hangzhou Electric Power Multi-School 9 (Summary + Supplement)

summary Today, this multi-school should be the best one to hit this summer vacation (although the ranking is not very high). My starting teammate found that the tree dp was signed in for question 1009. I thought about guessing an even-numbered side. I stared at my teammate and wrote A for ten minutes. Then we went to see 1003 again. After my t ...

Posted by thomasgrant on Thu, 18 Aug 2022 22:30:52 +0300

Programming problems related to C++ Dijkstra algorithm

#include<iostream> using namespace std; #define N 10000 #define Linit 11 void Dijstra(int edges[][Linit], int origin, int* dist, int* path); int main() { char str[200] = {'1','-','4',',','1','-','6',',','2','-','4',',','2','-','6',',','3','-','5',',','3','-','6',',','4','-','5',',','5','-','6'}; int origin = 1; int target = 3; in ...

Posted by dirkbonenkamp on Sat, 02 Jul 2022 21:45:03 +0300

libtorch study notes - MNIST combat

MNIST libtorch practical exercise Ready to work First download the MNIST database, http://yann.lecun.com/exdb/mnist/ After downloading, do not decompress it with software such as winrar. For example, t10k-images-idx3-ubyte is decompressed into t10k-images.idx3-ubyte. It is best to decompress it with tar in Linux environment. Suppose you unzip t ...

Posted by chrys on Wed, 25 May 2022 15:51:55 +0300

C++ copy constructor

copy constructor We often use a variable to initialize a variable of the same type, so there should be similar operations for custom types, so how to use an existing object to create another same object when creating an object? Constructor: There is only a single parameter, which is a reference to an object of this class type (usually cons ...

Posted by mad81 on Wed, 25 May 2022 10:40:27 +0300

C + + learning | implementation principle of polymorphism virtual destructor, pure virtual function and abstract class

1. Introduction The basic concept of polymorphism and two simple examples based on polymorphism are introduced above. This paper will introduce the specific implementation principle of polymorphism and the use of constructor and destructor in polymorphism. 2. Implementation principle of polymorphism The key to polymorphism is that when a vi ...

Posted by Bullit on Wed, 25 May 2022 10:28:08 +0300

Operating system experiment 11: read / write the specified location information of the disk (just complete the reading)

Experiment 11: read / write the specified location information of the disk (just complete the reading) 1, Experimental purpose (1) Knowledge of Disk Physics. (2) Master the API for disk operation provided by Windows system. (3) Read / write the specified sector according to the entered sector number. 2, Experimental preparation knowledge: intro ...

Posted by floR on Wed, 25 May 2022 06:36:39 +0300