go to start Ex W7
|home |print view |recent changes |changed April 18, 2017 |
exact
|You are 54.81.59.211 <- set your identity!

Sections: Compile-Time Computation | TESTAT 2: BoundedBuffer with iterators (const and non-const) and allowing – Non-Default-Constructible Elements | Non-Const Iterators | Non-Default-Constructible Elements |

Compile-Time Computation ^

Implement computing the nth fibonacci number in the following means as compile-time computation

Do the same variations (except the first) returning an array of size n of the n first fibonacci numbers instead. Use the std::array clone from the lecture providing constexpr mutating member functions.

TESTAT 2: BoundedBuffer with iterators (const and non-const) and allowing – Non-Default-Constructible Elements ^

Due date: Thursday 13. April 2017 23:59 (CET)

Non-Const Iterators ^

In the exercise last week you have implemented iterators for your BoundedBuffer. Complete that exercise first. The iterators exercise was a bit simplified by the restriction to only allow constant iterators, i.e. you could not modify the elements in the buffer retrieved through an iterator. Your first task in this exercise is to change this. Iterators for non-const BoundedBuffers shall allow modification of the buffer's elements.

Here you have an extended version of the iterator test cases: https:files/IteratorSuiteForBoundedBuffer.zip

Hints:

Non-Default-Constructible Elements ^

Adapt your dynamic bounded buffer to allow non-default-constructible types as element type. Use the approach you have seen in the lecture two weeks ago (allocating a char[size] array and use placement new to move/copy the elements to the corresponding location).

Make sure that elements in the buffer get destructed exactly once (no undestroyed elements and no double deletes)!

Since you do not allocate arrays of the element type anymore the test cases for new and delete change, i.e. those operators of the element type are not used anymore. The bounded_buffer_heap_memory_suite has been adapted accordingly.

Here are the test cases: https:files/NonDefaultConstructibleTypeTests.zip

Hints:


|home |print view |recent changes |changed April 18, 2017 |
exact
|You are 54.81.59.211 <- set your identity!

Ex W7
go to start