Skip to content

Commit

Permalink
[build] fix prettyprint MSVC compatibility
Browse files Browse the repository at this point in the history
fix build issues with MSVC 2017, from:
jgehring/cxx-prettyprint@4186b8f
  • Loading branch information
yann-lty authored and fabiencastan committed May 9, 2020
1 parent db23538 commit 1b6bf7d
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/aliceVision/prettyprint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,33 @@ namespace pretty_print
struct has_begin_end : private sfinae_base
{
private:
#ifdef _MSC_VER
// Work around MSVC ICE in 15.9.x by moving decltype out to template
// typename
template <typename C, typename LEFT = C::const_iterator(C::*)() const>
static yes & f(typename std::enable_if<
std::is_same<decltype(static_cast<typename LEFT>(&C::begin)),
typename C::const_iterator(C::*)() const>::value>::type *);
#else // _MSCV_VER
template <typename C>
static yes & f(typename std::enable_if<
std::is_same<decltype(static_cast<typename C::const_iterator(C::*)() const>(&C::begin)),
typename C::const_iterator(C::*)() const>::value>::type *);
#endif // _MSCV_VER

template <typename C> static no & f(...);

#ifdef _MSC_VER
template <typename C, typename LEFT = C::const_iterator(C::*)() const>
static yes & g(typename std::enable_if<
std::is_same<decltype(static_cast<typename LEFT>(&C::end)),
typename C::const_iterator(C::*)() const>::value, void>::type*);
#else // _MSCV_VER
template <typename C>
static yes & g(typename std::enable_if<
std::is_same<decltype(static_cast<typename C::const_iterator(C::*)() const>(&C::end)),
typename C::const_iterator(C::*)() const>::value, void>::type*);
std::is_same<decltype(static_cast<typename C::const_iterator(C::*)() const>(&C::end)),
typename C::const_iterator(C::*)() const>::value, void>::type*);
#endif // _MSCV_VER

template <typename C> static no & g(...);

Expand Down

0 comments on commit 1b6bf7d

Please sign in to comment.