C + + multi file structure and compilation preprocessing commands (Chapter 5)
catalogue
Multi file structure and compilation preprocessing commands
General organization of C + + programs
Example 5-10 multi file project
External variable
External function
Restrict variables and functions to compilation units
Standard C + + Library
Compilation preprocessing
l #include include instruction
l #define macro definit ...
Added by cavolks on Fri, 14 Jan 2022 00:32:53 +0200
Behavioral iterator pattern
The function of iterator: traverse a collection of the same elements.
The iterator pattern is a behavioral design pattern.
The idea of iterator: traverse the values of the elements in the collection in some way without changing the underlying elements.
Implementation of iterator:
1: premise: a collection element class, a collection class, a ...
Added by devx on Fri, 14 Jan 2022 00:16:18 +0200
Unmanned CPP shared pointer
Unmanned CPP shared pointer
Usage of shared pointers
The shared_ptr is provided in the current Boost library and should be a template class provided in the standard library of C++1x in the future. Previously, the "auto_ptr" in the ISO/IEC 14882:2003 standard library had similar functions. Obviously shared_ PTR is better than auto_ P ...
Added by amitkrathi on Thu, 13 Jan 2022 20:05:26 +0200
Eigenvector quantization memory alignment / Eigen SSE compatibility, memory allocation / EIGEN_MAKE_ALIGNED_OPERATOR_NEW
1. Summary
For basic data types and user-defined types, we need to use precompiled instructions to ensure stack memory alignment, and rewrite operator new to ensure heap memory alignment. For nested custom types, the alignment of their internal data types will be automatically guaranteed when applying for stack memory, and operator new still n ...
Added by todd-imc on Thu, 13 Jan 2022 17:17:58 +0200
HENAU winter camp search topic (A-L)
A - chessboard problem
Put pieces on a chessboard of a given shape (the shape may be irregular), and there is no difference between the pieces. It is required that any two pieces cannot be placed in the same row or column in the chessboard. Please program to solve all feasible placement schemes C for placing k pieces for a chessboard of given ...
Added by shanu_040 on Thu, 13 Jan 2022 15:58:38 +0200
C + + operator overloading
C + + operator overloading
The operands of predefined operators in C + + can only be basic data types.
But in fact, similar operations are required for many user-defined types (such as classes).
Therefore, you can redefine or overload most of the built-in operators in C + +. This allows you to use custom type operators.
Operator overloading is ...
Added by ojeffery on Thu, 13 Jan 2022 13:43:29 +0200
Codeforces Round #765 (Div. 2) A~C problem solution (it's so simple, super detailed and necessary for getting started)
A. Ancient Civilization
Title portal
I'll give you an array a (decimal) with a length of n,, now ask you to take out an ANS (decimal system),, so that the sum of position differences corresponding to a[i] (binary) and ans (binary) is minimized.
Take chestnuts for example: the binary of a[i]=5 is 101, and the binary of ans=10 is 1010. When w ...
Added by Shazbot! on Thu, 13 Jan 2022 10:59:53 +0200
Algorithm problem 1: minimum covering substring
1, Problem description
Here are two strings S and T. please find the shortest substring containing all the characters in T in S. If there is no such substring, the algorithm returns an empty string; If such a substring is found, the answer can be considered to be unique.
2, Violent solution
1. Algorithm
//Violent solution
string fun(string ...
Added by mikeyca on Thu, 13 Jan 2022 08:10:15 +0200
C + + Beginner Level: introduction to basic syntax
C + + basic syntax
C language is a structured language, which is not suitable for large-scale program development. Bjarne et al. Adapted to the object-oriented idea and invented a new language based on C language, called C + +. C + + is based on C language. It was originally called C with class. It added the concept of class, and then grad ...
Added by CowGuy on Thu, 13 Jan 2022 04:12:34 +0200
C. Division by Two and Permutation
Catalog
C. Division by Two and Permutation
A. Plus One on the Subset
B. Make AP
C. Division by Two and Permutation
Topic Description
Interpretation
Given a n array of size n, you can do something like delete a and put a/2 (rounding down) into the array. We can do this many times and output YES if we can get a full permutation ...
Added by DaveTomneyUK on Wed, 12 Jan 2022 22:59:51 +0200