utilities: Restrict pxWindowAndFlag templates to wxObject derived classes

Fixes a compile error (C2666) on VS2017 15.8 caused by ambiguity issues.
The sstream header uses

constexpr auto _both = ios_base::in | ios_base::out;

Without the extra type restrictions the compiler cannot tell whether to
use the template or the built-in | operator (the const wxSizerFlags &
parameter will accept ints).
This commit is contained in:
Jonathan Li 2018-08-17 09:36:17 +01:00
parent b84a2cfaf6
commit 890d7ab953
1 changed files with 2 additions and 2 deletions

View File

@ -199,14 +199,14 @@ struct pxWindowAndFlags
extern wxSizerFlags operator&(const wxSizerFlags &_flgs, const wxSizerFlags &_flgs2);
template <typename WinType>
template <typename WinType, typename = typename std::enable_if<std::is_base_of<wxObject, WinType>::value>::type>
pxWindowAndFlags<WinType> operator|(WinType *_win, const wxSizerFlags &_flgs)
{
pxWindowAndFlags<WinType> result = {_win, _flgs};
return result;
}
template <typename WinType>
template <typename WinType, typename = typename std::enable_if<std::is_base_of<wxObject, WinType>::value>::type>
pxWindowAndFlags<WinType> operator|(WinType &_win, const wxSizerFlags &_flgs)
{
pxWindowAndFlags<WinType> result = {&_win, _flgs};