小编lak*_*ake的帖子

第一个模板中的“::type=0”是什么意思?

以下是部分代码?

// Null-delimited strings, and the like.

template < typename CharT,
           typename std::enable_if <
               std::is_pointer<CharT>::value &&
               !std::is_array<CharT>::value &&
               std::is_integral<typename std::remove_pointer<CharT>::type>::value &&
               sizeof(typename std::remove_pointer<CharT>::type) == 1,
               int >::type = 0 >
contiguous_bytes_input_adapter input_adapter(CharT b)
{
    auto length = std::strlen(reinterpret_cast<const char*>(b));
    const auto* ptr = reinterpret_cast<const char*>(b);
    return input_adapter(ptr, ptr + length);
}

template<typename InputType>
JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json parse(InputType&& i,
                        const parser_callback_t cb = nullptr,
                        const bool allow_exceptions = true,
                        const bool ignore_comments = false)
{
    basic_json result;
    parser(detail::input_adapter(std::forward<InputType>(i)), cb, allow_exceptions, ignore_comments).parse(true, …
Run Code Online (Sandbox Code Playgroud)

c++ templates

3
推荐指数
1
解决办法
95
查看次数

标签 统计

c++ ×1

templates ×1