-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Louis-Charles Caron
committed
Nov 8, 2023
1 parent
ed9f254
commit 07dbf1f
Showing
7 changed files
with
101 additions
and
358 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) 2023 Louis-Charles Caron | ||
|
||
// This file is part of the safe library (https://github.com/LouisCharlesC/safe). | ||
|
||
// Use of this source code is governed by an MIT-style license that can be | ||
// found in the LICENSE file or at https://opensource.org/licenses/MIT. | ||
|
||
#pragma once | ||
|
||
namespace safe | ||
{ | ||
namespace impl | ||
{ | ||
// This set of template and specializations is used to extract the type of the last argument of a paramter pack. | ||
template <typename... Ts> struct Last; // Base template, specializations cover all uses. | ||
template <typename First, typename Second, typename... Others> struct Last<First, Second, Others...> | ||
{ | ||
using type = typename Last<Second, Others...>::type; | ||
}; | ||
template <typename T> struct Last<T> | ||
{ | ||
using type = T; | ||
}; | ||
template <> struct Last<> | ||
{ | ||
using type = void; | ||
}; | ||
} // namespace impl | ||
|
||
template <typename... Ts> using Last = typename impl::Last<Ts...>::type; | ||
} // namespace safe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.