How to realize the General two-way linked list in MYSQL INNODB
The purpose of this article is to share with you how to implement a general two-way linked list in MYSQL INNODB. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The source code is in Ut0lst.h
Note: here I refer to the actual concatenated data in the linked list as data classes such as lock_t, mem_block_t
Linked list, as a very important data structure, can be used everywhere. Here is a brief explanation of innodb bidirectional.
For the implementation of linked lists, let's take a look at the charm of innodb linked list design:
Often seen in some structures
UT_LIST_BASE_NODE_T (mem_block_t) base
UT_LIST_NODE_T (mem_block_t) list
As the most basic data structure, the exquisite implementation of innodb involves four important C++ knowledge points:
1. Imitating function
2. Class member pointer
3. Class template
4. Function overloading
To put it simply, a parody function is a class in the form of a function call, and the class member pointer is not in the real sense.
Pointer, but an offset to the relative position of an object of a particular class.
For example, the following is a mock function class:
Click (here) to collapse or open
Template
Class ShowElemt
{
Public:
ShowElemt ()
{
N = 0
}
Void operator () (T & t)
{
Nasty +
Cout