forked from microsoft/terminal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoperators.hpp
59 lines (47 loc) · 1.36 KB
/
operators.hpp
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
48
49
50
51
52
53
54
55
56
57
58
59
/*++
Copyright (c) Microsoft Corporation.
Licensed under the MIT license.
Module Name:
- operators.hpp
Abstract:
- This file contains helpful operator overloading for some older data structures.
Author(s):
- Austin Diviness (AustDi) Mar 2017
--*/
#pragma once
constexpr bool operator==(const COORD& a, const COORD& b) noexcept
{
return (a.X == b.X &&
a.Y == b.Y);
}
constexpr bool operator!=(const COORD& a, const COORD& b) noexcept
{
return !(a == b);
}
constexpr bool operator==(const SMALL_RECT& a, const SMALL_RECT& b) noexcept
{
return (a.Top == b.Top &&
a.Left == b.Left &&
a.Bottom == b.Bottom &&
a.Right == b.Right);
}
constexpr bool operator!=(const SMALL_RECT& a, const SMALL_RECT& b) noexcept
{
return !(a == b);
}
constexpr bool operator==(const std::wstring& wstr, const std::wstring_view& wstrView)
{
return (wstrView == std::wstring_view{ wstr.c_str(), wstr.size() });
}
constexpr bool operator==(const std::wstring_view& wstrView, const std::wstring& wstr)
{
return (wstr == wstrView);
}
constexpr bool operator!=(const std::wstring& wstr, const std::wstring_view& wstrView)
{
return !(wstr == wstrView);
}
constexpr bool operator!=(const std::wstring_view& wstrView, const std::wstring& wstr)
{
return !(wstr == wstrView);
}