the use of noexcept

Hello every one.
I know what noexcept does, at a basic level, but the way it is used in the code below is pretty much confusing to me.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <type_traits>
#include <memory>
#include <iterator>
#include <utility>
#include <sstream>

namespace chesspp
{
    inline namespace util_ops
    {
        template<typename T, typename U>
        auto operator!=(T const &t, U const &u) noexcept(noexcept(!(t == u)))
        -> typename std::enable_if<std::is_base_of<T, U>::value ||
        std::is_base_of<U, T>::value, decltype(!(t == u))>::type
        {
            return !(t == u);
        }
    }
}

could someone tell me what this part :
1
2
3
noexcept(noexcept(!(t == u)))
-> typename std::enable_if<std::is_base_of<T, U>::value ||
std::is_base_of<U, T>::value, decltype(!(t == u))>::type

is meant to do ?
what does the arrow operator do here ? i haven't seen such use of it.

The code is a part of the Chessplusplus project source: "Utilities.hpp".

In advance, I'd like to thank those who'd make time and clarify this or point
to some useful links.
It is a conditional noexcept statement.

Aceix.
This is a conditional noexcept.

Aceix.
Everything after the arrow -> is part of the trailing return type. I wrote that code a few months ago, I don't know if it is even accomplishing what I wanted it to do.
Last edited on
Topic archived. No new replies allowed.