# 118 List to set
Implementation
C++

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating resource.

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

Other implementations
import java.util.HashSet;
import java.util.List;
Set<T> y = new HashSet<>(x);
y := make(map[T]struct{}, len(x))
for _, v := range x {
	y[v] = struct{}{}
}
y = set(x)
bool[typeof(x[0])] y;

foreach (e ; x)
    y[e] = true;
import std.container;
auto y = redBlackTree(x);
import qualified Data.Set as Set
y = Set.fromList x
var y = new Set(x);
require 'set'
y = x.to_set
my %y = map {$_=>0} @x;
y = x |> Enum.uniq |> List.to_tuple
y = MapSet.new(x)
use std::collections::HashSet;
let y = x.iter().cloned().collect::<HashSet<_>>();
local hash = {}
local y = {}
for _,v in ipairs(x) do
   if (not hash[v]) then
       y[#y+1] = v
       hash[v] = true
   end
end
#include<unordered_set>
std::unordered_set<T> y (x.begin (), x.end ());
$y = array_unique($x);
for i := Low(X) to High(X) do Include(Y,X[i]);
val y = x.toSet
void main() {
  List<int> list = [1,2,3,4,5];
  list.toSet(); 
  print(list);
}
using System.Collections.Generic;
static void Main(string[] args)
{
    string[] x = new string[] { "a", "b", "c", "b" };
    HashSet<string> y = new HashSet<string>(x);
}
(setf y (remove-duplicates x))
(def y (set x))
set(x)
Y = sets:from_list(X).