0

In specific class,

It is working..

private:
template <typename U>
int64_t parseValue(const std::string& str
        , typename std::enable_if<std::is_signed<T>::value, U>::type* = 0
        ) const
{
    return stoll(str, 0, base_);
}

template <typename U>
uint64_t parseValue(const std::string& str
        , typename std::enable_if<std::is_unsigned<T>::value, U>::type* = 0
        ) const
{

but the code below does not work. I do not know why. I do not know if there is a lack of specialization concepts or other problems.

private:
template <typename U>
int64_t parseValue(const std::string& str
        , typename std::enable_if<std::is_signed<T>::value>::type* = 0
        ) const
{
    return stoll(str, 0, base_);
}

template <typename U>
uint64_t parseValue(const std::string& str
        , typename std::enable_if<std::is_unsigned<T>::value>::type* = 0
        ) const

It is not working.

Could you explain? I don't know why..

naig
  • 47
  • 4
  • Can you please post a [mcve]? I can guess why it doesn't work, but without a complete example, it would be just a guess. – Praetorian Sep 19 '17 at 03:51

1 Answers1

0

In the second case, you are not using U in the enable_if statements. SFINAE only works if the expression depends on one of the deduced template parameters.

SU3
  • 5,064
  • 3
  • 35
  • 66