Logo

Programming-Idioms

Create t consisting of 3 values having different types.

Explain if the elements of t are strongly typed or not.
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
t := []any{
	2.5,
	"hello",
	make(chan int),
}
t = (2.5, "hello", -1)
let t = (2.5, "hello", -1);
let t = [2.5, "hello", -1];
type
  Tuple = record
    a: integer;
    b: string;
    c: boolean;
  end;
var
  t: Tuple;
begin
  t := Default(Tuple);
end.
t = [2.5, "hello", -1]
t = (a, b, c)
var t = (2.5f, "foo", true);
#include <tuple>
auto t = std::make_tuple(2.5f, std::string("foo"), false);
Dim t = (2.5F, "foo", True)
a, b, c := 2.5, "hello", make(chan int)
let t = 1, 'a', "b"
use constant t => (1, 'two', 3.5);
val t = Triple(2.5, "foo", true)
record Tuple(int a, String b, boolean c) {}
var t = new Tuple(1, "hello", true);
import std.typecons;
auto value = tuple(5, 6.7, "hello");
import std.typecons;
auto entry = tuple!("index", "value", "active")(4, "Hello", true);