Commit b7b6f8fe authored by Adam Procter's avatar Adam Procter

Fix for systems where int64_t == ptrdiff_t

parent 9af0ae2f
......@@ -73,7 +73,20 @@ namespace ngraph
}
/// \brief Convert this dimension to `ptrdiff_t`. This dimension must be static.
/// \throws std::invalid_argument If this dimension is dynamic.
explicit operator ptrdiff_t() const
///
/// The type signature here is a bit confusing, so it bears explanation. On some systems,
/// `ptrdiff_t` and `int64_t` are equivalent. This means we cannot declare conversion
/// operators for both types. On other systems, `ptrdiff_t` and `int64_t` are different,
/// so we _have_ to declare a separate conversion operator for `ptrdiff_t`.
///
/// On systems where `int64_t` and `ptrdiff_t` are the same type, this definition will be
/// disabled. On systems where they are different, it is equivalent to:
///
/// explicit operator ptrdiff_t() const { ... }
///
explicit
operator std::enable_if<!std::is_same<int64_t, ptrdiff_t>::value, ptrdiff_t>::type()
const
{
if (is_dynamic())
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment