Debian Codegraph @

libphobos/libdruntime/core/stdcpp/utility.d

raw
1 /**
2 * D header file for interaction with Microsoft C++ <utility>
3 *
4 * Copyright: Copyright (c) 2018 D Language Foundation
5 * License: Distributed under the
6 * $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0).
7 * (See accompanying file LICENSE)
8 * Authors: Manu Evans
9 * Source: $(DRUNTIMESRC core/stdcpp/utility.d)
10 */
11
12 module core.stdcpp.utility;
13
14 import core.stdcpp.xutility : StdNamespace;
15
16 extern(C++, (StdNamespace)):
17 @nogc:
18
19 /**
20 * D language counterpart to C++ std::pair.
21 *
22 * C++ reference: $(LINK2 https://en.cppreference.com/w/cpp/utility/pair)
23 */
24 struct pair(T1, T2)
25 {
26 ///
27 alias first_type = T1;
28 ///
29 alias second_type = T2;
30
31 ///
32 T1 first;
33 ///
34 T2 second;
35
36 // FreeBSD has pair as non-POD so add a contructor
37 version (FreeBSD)
38 {
39 this(T1 t1, T2 t2) inout
40 {
41 first = t1;
42 second = t2;
43 }
44 this(ref return scope inout pair!(T1, T2) src) inout
45 {
46 first = src.first;
47 second = src.second;
48 }
49 }
50 }