C++ Группа 1 — различия между версиями

Материал из SEWiki
Перейти к: навигация, поиск
()
(Advanced)
 
(не показано 8 промежуточных версий этого же участника)
Строка 10: Строка 10:
 
Также реализовать специализацию получившегося шаблона оптимизированную для хранения бит: vector<bool>.
 
Также реализовать специализацию получившегося шаблона оптимизированную для хранения бит: vector<bool>.
  
== intro to exceptions ==
+
== Intro to exceptions ==
  
 
https://www.dropbox.com/s/opxblrdj74gieeg/assignment.cc?dl=0
 
https://www.dropbox.com/s/opxblrdj74gieeg/assignment.cc?dl=0
 +
 
https://www.dropbox.com/s/8xivap6w7n97qix/new_assignment.cc?dl=0
 
https://www.dropbox.com/s/8xivap6w7n97qix/new_assignment.cc?dl=0
 +
 +
== Exceptions Safety ==
 +
 +
==== Main ====
 +
 +
Reconsider your own `vector` implementation towards making it ''[http://en.wikipedia.org/wiki/Exception_safety exception-safe]''.
 +
 +
Following members of your `vector` implementation should be reconsidered to match corresponding ''[http://en.wikipedia.org/wiki/Exception_safety exception-safety guarantees]'':
 +
 +
* '''operator='''  (strong)
 +
* '''push_back''' (strong)
 +
 +
==== Extra ====
 +
 +
Try match your implementation on the functions predefined inside STL.
 +
 +
Try to reduce boilerplate inside your implementation relying on the standard-library defined utilities.
 +
 +
''Hint'': see [http://en.cppreference.com/w/cpp/header/memory memory] header closely (`uninitialized_*` family).
 +
 +
== Deque ==
 +
 +
Implement double-ended queue matching interface of thereof inside STL ([http://en.cppreference.com/w/cpp/container/deque std::deque]) and ''matching'' its performance requirements.
 +
 +
At the very least, it should contain following members:
 +
 +
* ''push_back''
 +
* ''pop_back''
 +
* ''push_front''
 +
* ''pop_front''
 +
* ''insert''
 +
* ''clear''
 +
* ''resize''
 +
* ''back''
 +
* ''front''
 +
* ''size''
 +
* ''begin/rbegin''
 +
* ''end/rend''
 +
 +
'''NB''': Implementing deque matching performance requirements of the STL one, try to minimize ''unused'' memory 'committed' by your implementation.
 +
 +
If you consider that it's impossible, be ready to assure your point.
 +
 +
 +
== Algorithms quiz ==
 +
 +
== Functors ==
 +
 +
=== Basic ===
 +
 +
Implement `mem_fn` functor class to match the behaviour of `std::mem_fn`
 +
 +
https://www.dropbox.com/s/ur030ymh9ogetm3/assignment.cc?dl=0
 +
 +
=== Advanced ===
 +
 +
Implement place-holding logic of the `std::bind`
 +
 +
https://www.dropbox.com/s/pidfxlzc18kvl1y/bind.cc?dl=0

Текущая версия на 12:51, 25 марта 2016

Кудинкин Алексей

alexey.kudinkin@gmail.com

+7-911-748-38-35

vector<T>/vector<bool>

Реализовать шаблонную версию ранее реализованного контейнера vector. Также реализовать специализацию получившегося шаблона оптимизированную для хранения бит: vector<bool>.

Intro to exceptions

https://www.dropbox.com/s/opxblrdj74gieeg/assignment.cc?dl=0

https://www.dropbox.com/s/8xivap6w7n97qix/new_assignment.cc?dl=0

Exceptions Safety

Main

Reconsider your own `vector` implementation towards making it exception-safe.

Following members of your `vector` implementation should be reconsidered to match corresponding exception-safety guarantees:

  • operator= (strong)
  • push_back (strong)

Extra

Try match your implementation on the functions predefined inside STL.

Try to reduce boilerplate inside your implementation relying on the standard-library defined utilities.

Hint: see memory header closely (`uninitialized_*` family).

Deque

Implement double-ended queue matching interface of thereof inside STL (std::deque) and matching its performance requirements.

At the very least, it should contain following members:

  • push_back
  • pop_back
  • push_front
  • pop_front
  • insert
  • clear
  • resize
  • back
  • front
  • size
  • begin/rbegin
  • end/rend

NB: Implementing deque matching performance requirements of the STL one, try to minimize unused memory 'committed' by your implementation.

If you consider that it's impossible, be ready to assure your point.


Algorithms quiz

Functors

Basic

Implement `mem_fn` functor class to match the behaviour of `std::mem_fn`

https://www.dropbox.com/s/ur030ymh9ogetm3/assignment.cc?dl=0

Advanced

Implement place-holding logic of the `std::bind`

https://www.dropbox.com/s/pidfxlzc18kvl1y/bind.cc?dl=0