Skip to content

Commit

Permalink
Commets added
Browse files Browse the repository at this point in the history
  • Loading branch information
John Wellbelove committed Sep 21, 2023
1 parent b2b4895 commit 2b6f6de
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions include/etl/overload.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,35 @@ namespace etl
template <typename... TRest>
struct overload;

//*************************************************************************
/// Specialisation for multiple overloads.
//*************************************************************************
template <typename TOverload, typename... TRest>
struct overload<TOverload, TRest...> : TOverload, overload<TRest...>
{
overload(TOverload ovl0, TRest... rest) : TOverload(ovl0), overload<TRest...>(rest...) {}
overload(TOverload first, TRest... rest) : TOverload(first), overload<TRest...>(rest...)
{
}

using TOverload::operator();
using overload<TRest...>::operator();
};

//*************************************************************************
/// Specialisation for one overload.
//*************************************************************************
template <typename TOverload>
struct overload<TOverload> : TOverload
{
overload(TOverload ovl0) : TOverload(ovl0) {}
overload(TOverload first) : TOverload(first)
{
}

using TOverload::operator();
};

//*************************************************************************
/// Make an overload.
//*************************************************************************
template <typename... TRest>
overload<TRest...> make_overload(TRest... overloads)
Expand Down

0 comments on commit 2b6f6de

Please sign in to comment.