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

Материал из SEWiki
Перейти к: навигация, поиск
Строка 34: Строка 34:
  
 
''Hint'': see [http://en.cppreference.com/w/cpp/header/memory memory] header closely (`uninitialized_*` family).
 
''Hint'': see [http://en.cppreference.com/w/cpp/header/memory memory] header closely (`uninitialized_*` family).
 +
 +
== #4 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.

Версия 10:46, 11 марта 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).

#4 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.