tailieunhanh - Lecture Programming principles and practice using C++: Chapter 17 - Bjarne Stroustrup

Vector is not just the most useful standard container, it is also provides examples of some of the most important/powerful/interesting implementation techniques. In this, we go through a series of increasingly sophisticated vector implementations, seeing classical problems related to use of memory and providing solutions. Here, we discuss free store (heap storage) management, and pointers. | Chapter 17 vector and Free Store Bjarne Stroustrup Abstract Vector is not just the most useful standard container, it is also provides examples of some of the most important/powerful/interesting implementation techniques. In this and the following lectures, we go through a series of increasingly sophisticated vector implementations, seeing classical problems related to use of memory and providing solutions. Here, we discuss free store (heap storage) management, and pointers. Stroustrup/Programming Overview Vector revisited How are they implemented? Pointers and free store Allocation (new) Access Arrays and subscripting: [] Dereferencing: * Deallocation (delete) Destructors Initialization Copy and move Arrays Array and pointer problems Changing size Templates Range checking and exceptions Stroustrup/Programming Vector Vector is the most useful container Simple Compactly stores elements of a given type Efficient access Expands to hold any number . | Chapter 17 vector and Free Store Bjarne Stroustrup Abstract Vector is not just the most useful standard container, it is also provides examples of some of the most important/powerful/interesting implementation techniques. In this and the following lectures, we go through a series of increasingly sophisticated vector implementations, seeing classical problems related to use of memory and providing solutions. Here, we discuss free store (heap storage) management, and pointers. Stroustrup/Programming Overview Vector revisited How are they implemented? Pointers and free store Allocation (new) Access Arrays and subscripting: [] Dereferencing: * Deallocation (delete) Destructors Initialization Copy and move Arrays Array and pointer problems Changing size Templates Range checking and exceptions Stroustrup/Programming Vector Vector is the most useful container Simple Compactly stores elements of a given type Efficient access Expands to hold any number of elements Optionally range-checked access How is that done? That is, how is vector implemented? We'll answer that gradually, feature after feature Vector is the default container Prefer vector for storing elements unless there's a good reason not to Stroustrup/Programming Building from the ground up The hardware provides memory and addresses Low level Untyped Fixed-sized chunks of memory No checking As fast as the hardware architects can make it The application builder needs something like a vector Higher-level operations Type checked Size varies (as we get more data) Run-time range checking Close to optimally fast Stroustrup/Programming Building from the ground up At the lowest level, close to the hardware, life’s simple and brutal You have to program everything yourself You have no type checking to help you Run-time errors are found when data is corrupted or the program crashes We want to get to a higher level as quickly as we can To become productive and reliable To use a .

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.