terminal/src/inc/operators.hpp
Dustin Howett d4d59fa339 Initial release of the Windows Terminal source code
This commit introduces all of the Windows Terminal and Console Host source,
under the MIT license.
2019-05-02 15:29:04 -07:00

60 lines
1.4 KiB
C++

/*++
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);
}