-
Notifications
You must be signed in to change notification settings - Fork 1
/
Util.h
47 lines (43 loc) · 947 Bytes
/
Util.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
using namespace Windows::Foundation::Collections;
using namespace Platform;
using namespace Platform::Collections;
using namespace AlgorithmVisualization;
namespace AlgorithmVisualization {
/// <summary>
/// 工具类
/// </summary>
public ref class Util sealed
{
internal:
template<class T>
static IVector<T>^ CopyVector(IVector<T>^ from);
template<class T>
static IVector<IVector<T>^>^ Copy2DVector(IVector<IVector<T>^>^ from);
};
template<class T>
inline IVector<T>^ Util::CopyVector(IVector<T>^ from)
{
auto To = ref new Vector<T>();
for (auto i : from)
{
To->Append(i);
}
return To;
}
template<class T>
inline IVector<IVector<T>^>^ Util::Copy2DVector(IVector<IVector<T>^>^ from)
{
auto To = ref new Vector<IVector<T>^>();
for (IVector<T>^ i : from)
{
auto ToRow = ref new Vector<T>();
for (T j : i)
{
ToRow->Append(j);
}
To->Append(ToRow);
}
return To;
}
}