Error message

  • Deprecated function: Return type of DatabaseStatementBase::execute($args = [], $options = []) should either be compatible with PDOStatement::execute(?array $params = null): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2244 of /home2/psicolog/public_html/feliponcho/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /home2/psicolog/public_html/feliponcho/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /home2/psicolog/public_html/feliponcho/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /home2/psicolog/public_html/feliponcho/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /home2/psicolog/public_html/feliponcho/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /home2/psicolog/public_html/feliponcho/includes/database/database.inc).
  • Deprecated function: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in drupal_random_bytes() (line 2268 of /home2/psicolog/public_html/feliponcho/includes/bootstrap.inc).
  • Deprecated function: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated in url() (line 2349 of /home2/psicolog/public_html/feliponcho/includes/common.inc).
  • Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in url_is_external() (line 2393 of /home2/psicolog/public_html/feliponcho/includes/common.inc).
  • Deprecated function: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in url_is_external() (line 2395 of /home2/psicolog/public_html/feliponcho/includes/common.inc).
  • Deprecated function: ltrim(): Passing null to parameter #1 ($string) of type string is deprecated in url() (line 2311 of /home2/psicolog/public_html/feliponcho/includes/common.inc).

STL

C++ Standard Template Library

Overview

  • The Standard Template Library (STL) is one of the most important features added to C++ in recent years.
  • STL provides general-purpose, templatized classes and functions that implement algorithms and data structures.
  • Although the syntax of STL can be intimidating, it is actually quite easy to use once an understanting of hos it is constructed is known.
  • At the core of the STL are three foundational items:
    • Containers
    • Algorithms
    • Iterators
  • These items work in conjuction with one another to provide off-the-shelf solutions to a variety of programming problems.

Containers

  • Container are objects that hold other objects.
  • Container can be sequence containers such as vector class, deque and list. A sequence is a linear list.
  • Associative containers allow efficient retrieval of values based on keys. A map is an associative container as it provides access to values with unique keys.
  • Each container class defines a set of functions that may be applied to the container.
  • Container classes include vector, list, deque, set, multiset, map, multimap, hash set, hash multiset, hash map and hash_multimap.
  • They may also include other containers that are implementation dependen/extension.

Algorithms

  • Algorithms are used to process the elements of colelctions. For example, algorithms can search, sort and modify.
  • The data and operations in STL are decoupled. Container classes manage the data, and the operations are defined by the algorithms.
  • Algorithms operate on a range of elements within a container.

Iterators

  • Iterator is apointer used to manipulate the elements of the collections of objects. These collections may be containers or subsets of containers.
  • Iterators provide the ability to cycle through the contents of a container in much the same way as pointers are used to cycle through the contents of a container in much the same way as pointers are used to cycle through an array.
  • Every container class provides its own iterator type.
  • Iterator is a smart pointer. For example, to increment an iterator you call operator ++. To access the value of an iterator you may use operator *.
  • There are five types of iterators:

Types of Iterators

  • Conceptually, iterators are the linker between these two components. They let any algorithm interact with any container, graphically shown below.
  • Theoretically also, you can combine every kind of container with every kind of algorithm.

Relationship between Iterators, Containers and Algorithms

  • Relationship between the three STL components

Relationship between the STL components

Container Classes

Container Classes