|home |print view |recent changes |changed April 18, 2017 | |You are 18.104.22.168 <- set your identity!
Implement computing the nth fibonacci number in the following means as compile-time computation
Fibo<int>with a static const member value for the result
5_fibothat is evaluated at compile-time
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.
fiboathat takes the size of the array as template parameter. E.g.
10_fiboa(returns an array<int,10>).
Due date: Thursday 13. April 2017 23:59 (CET)
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
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
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
std::unique_ptr). For accessing the elements in the memory it is convenient to have a means for converting this
charpointer to a pointer to element type, e.g., by taking the address of the front() element.
|home |print view |recent changes |changed April 18, 2017 |
|You are 22.214.171.124
<- set your identity!