Logo

Programming-Idioms

Append the element x to the list s.
Implementation
C++

Implementation edit is for fixing errors and enhancing with metadata. Please do not replace the code below with a different implementation.

Instead of changing the code of the snippet, consider creating another C++ implementation.

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
s = append(s, x)
uses classes;
var
  L: TList;
  Item: Pointer;
...
  L.Add(Item);
...
$s[]=$x;
s << x
s ~= x;
s.append(x)
s.push(x);
s.push(x);
s.add(x);
(conj s x)
real, allocatable, dimension(:) :: s

s = [s, x]
push @s, $x;
s.Add(x)
s.Add(x);
s.add(x);
s[#s + 1] = x
table.insert(s, x)
#include <list>
s.emplace_back(x);
s = [...s, x];
xs = s ++ [x]
(reverse (cons x (reverse s)))