Skip to content

Commit dd4d008

Browse files
committed
Added ETL_NODISCARD to make_delegete functions
1 parent 37fd5b7 commit dd4d008

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

include/etl/private/delegate_cpp11.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ namespace etl
475475
//*************************************************************************
476476
/// Checks equality.
477477
//*************************************************************************
478+
ETL_NODISCARD
478479
ETL_CONSTEXPR14 bool operator == (const delegate& rhs) const
479480
{
480481
return invocation == rhs.invocation;
@@ -500,6 +501,7 @@ namespace etl
500501
//*************************************************************************
501502
/// Returns <b>true</b> if the delegate is valid.
502503
//*************************************************************************
504+
ETL_NODISCARD
503505
ETL_CONSTEXPR14 operator bool() const
504506
{
505507
return is_valid();
@@ -712,6 +714,7 @@ namespace etl
712714
/// Make a delegate from a free function.
713715
//*************************************************************************
714716
template <auto Function>
717+
ETL_NODISCARD
715718
constexpr auto make_delegate() ETL_NOEXCEPT
716719
{
717720
using function_type = typename etl::private_delegate::function_traits<decltype(Function)>::function_type;
@@ -723,6 +726,7 @@ namespace etl
723726
/// Make a delegate from a functor or lambda function.
724727
//*************************************************************************
725728
template <typename TLambda, typename = etl::enable_if_t<etl::is_class<TLambda>::value, void>>
729+
ETL_NODISCARD
726730
constexpr auto make_delegate(TLambda& instance) ETL_NOEXCEPT
727731
{
728732
using function_type = typename etl::private_delegate::function_traits<decltype(&TLambda::operator())>::function_type;
@@ -734,6 +738,7 @@ namespace etl
734738
/// Make a delegate from a functor, compile time.
735739
//*************************************************************************
736740
template <typename T, T& Instance>
741+
ETL_NODISCARD
737742
constexpr auto make_delegate() ETL_NOEXCEPT
738743
{
739744
using function_type = typename etl::private_delegate::function_traits<decltype(&T::operator())>::function_type;
@@ -745,6 +750,7 @@ namespace etl
745750
/// Make a delegate from a member function at compile time.
746751
//*************************************************************************
747752
template <typename T, auto Method, T& Instance, typename = etl::enable_if_t<!private_delegate::function_traits<decltype(Method)>::is_const>>
753+
ETL_NODISCARD
748754
constexpr auto make_delegate() ETL_NOEXCEPT
749755
{
750756
using function_type = typename etl::private_delegate::function_traits<decltype(Method)>::function_type;
@@ -756,6 +762,7 @@ namespace etl
756762
/// Make a delegate from a const member function at compile time.
757763
//*************************************************************************
758764
template <typename T, auto Method, const T& Instance, typename = etl::enable_if_t<private_delegate::function_traits<decltype(Method)>::is_const>>
765+
ETL_NODISCARD
759766
constexpr auto make_delegate() ETL_NOEXCEPT
760767
{
761768
using function_type = typename etl::private_delegate::function_traits<decltype(Method)>::function_type;
@@ -767,6 +774,7 @@ namespace etl
767774
/// Make a delegate from a member function at run time.
768775
//*************************************************************************
769776
template <typename T, auto Method>
777+
ETL_NODISCARD
770778
constexpr auto make_delegate(T& instance) ETL_NOEXCEPT
771779
{
772780
using function_type = typename etl::private_delegate::function_traits<decltype(Method)>::function_type;
@@ -778,6 +786,7 @@ namespace etl
778786
/// Make a delegate from a member function at run time.
779787
//*************************************************************************
780788
template <typename T, auto Method>
789+
ETL_NODISCARD
781790
constexpr auto make_delegate(const T& instance) ETL_NOEXCEPT
782791
{
783792
using function_type = typename etl::private_delegate::function_traits<decltype(Method)>::function_type;

0 commit comments

Comments
 (0)