diff options
author | 2013-04-27 13:32:27 -0700 | |
---|---|---|
committer | 2013-04-27 14:29:35 -0700 | |
commit | eb5bcb8eaf1a971491541ed646db224c3136063b (patch) | |
tree | fec98faaa3fb8e1a80f7312e44a0dcd2be8bb737 | |
parent | 6ca518bb0665c9d32ef040fe027e04f403382389 (diff) | |
download | paludis-eb5bcb8eaf1a971491541ed646db224c3136063b.tar.gz paludis-eb5bcb8eaf1a971491541ed646db224c3136063b.tar.xz |
silence 'unused local typedef' warning
The local typedef used for type checking is unreferenced, and causes spurious
warning with GCC 4.8. Use an inline std::enable_if return type munging to elide
template instantiations for unrelated types.
Signed-off-by: Saleem Abdulrasool <compnerd@compnerd.org>
-rw-r--r-- | paludis/util/visitor_cast-fwd.hh | 4 | ||||
-rw-r--r-- | paludis/util/visitor_cast.hh | 20 |
2 files changed, 6 insertions, 18 deletions
diff --git a/paludis/util/visitor_cast-fwd.hh b/paludis/util/visitor_cast-fwd.hh index 5fdfa2919..06ea2e46c 100644 --- a/paludis/util/visitor_cast-fwd.hh +++ b/paludis/util/visitor_cast-fwd.hh @@ -21,10 +21,12 @@ #define PALUDIS_GUARD_PALUDIS_UTIL_VISITOR_CAST_FWD_HH 1 #include <paludis/util/attributes.hh> +#include <type_traits> namespace paludis { - template <typename To_, typename From_> + template <typename To_, typename From_, + typename = typename std::enable_if<std::is_base_of<From_, To_>::value>::type> To_ * visitor_cast(From_ &) PALUDIS_ATTRIBUTE((warn_unused_result)); } diff --git a/paludis/util/visitor_cast.hh b/paludis/util/visitor_cast.hh index 568de2d8b..3ef277d47 100644 --- a/paludis/util/visitor_cast.hh +++ b/paludis/util/visitor_cast.hh @@ -40,17 +40,6 @@ namespace paludis } }; - template <typename To_, typename From_, bool ok_> - struct VerifyVisitorCastType - { - }; - - template <typename To_, typename From_> - struct VerifyVisitorCastType<To_, From_, true> - { - typedef int IsOK; - }; - template <typename C_, typename T_> struct CopyConst { @@ -63,13 +52,10 @@ namespace paludis typedef const T_ Type; }; - template <typename To_, typename From_> - To_ * visitor_cast(From_ & from) + template <typename To_, typename From_, typename> + To_ * + visitor_cast(From_ & from) { - /* verify that we are attempting to visitor_cast something that - * could potentially be true */ - typedef typename VerifyVisitorCastType<To_, From_, std::is_base_of<From_, To_>::value>::IsOK TypeIsOK; - VisitorCaster<To_, typename CopyConst<From_, typename From_::VisitableBaseClass>::Type> q; return from.template accept_returning<To_ *>(q); } |