Skip to main content

std::stack operator=

// (1) Non const version only
stack& operator=( const stack& other );

// (2) Non const version only
stack& operator=( stack&& other );

Replaces the contents of the container adaptor with those of other.

  • (1)
    Copy assignment operator. Replaces the contents with a copy of the contents of other.

    Effectively calls

    c = other.c
  • (2)
    Move assignment operator. Replaces the contents with those of other using move semantics.

    Effectively calls

    c = std::move(other.c)
note

Both operators are implicitly declared, which means that Container has to be copyable/movable for them to be generated.

Parameters

  • other - another container adaptor to use as data source

Return value

A reference to the container, *this.

Exceptions

Equivalent to that of operator= of the underlying container.

Complexity

Equivalent to that of operator= of the underlying container.

Example

important

This section requires improvement. You can help by editing this doc page.

std::stack operator=

// (1) Non const version only
stack& operator=( const stack& other );

// (2) Non const version only
stack& operator=( stack&& other );

Replaces the contents of the container adaptor with those of other.

  • (1)
    Copy assignment operator. Replaces the contents with a copy of the contents of other.

    Effectively calls

    c = other.c
  • (2)
    Move assignment operator. Replaces the contents with those of other using move semantics.

    Effectively calls

    c = std::move(other.c)
note

Both operators are implicitly declared, which means that Container has to be copyable/movable for them to be generated.

Parameters

  • other - another container adaptor to use as data source

Return value

A reference to the container, *this.

Exceptions

Equivalent to that of operator= of the underlying container.

Complexity

Equivalent to that of operator= of the underlying container.

Example

important

This section requires improvement. You can help by editing this doc page.