LILAC
Language to language Interop LAyer Compiler
Loading...
Searching...
No Matches
utils.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2024 Yeong-won Seo
3 *
4 * This file is part of LILAC.
5 *
6 * LILAC is free software: you can redistribute it and/or modify it under
7 * the terms of the GNU General Public License as published by the Free
8 * Software Foundation, either version 3, or (at your option) any later
9 * version.
10 *
11 * LILAC is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include "pch.h"
23
24template<typename T>
25std::initializer_list<T> GetInitializerList(std::vector<T> vector)
26{
27 union
28 {
29 std::initializer_list<T> list = {};
30
31 struct
32 {
33 T* begin;
34 size_t size;
35 };
36 };
37
38 begin = &vector[0];
39 size = vector.size();
40
41 return list;
42}
std::initializer_list< T > GetInitializerList(std::vector< T > vector)
Definition utils.h:25