C++ template specialization for pointer?

前端 未结 3 1858
青春惊慌失措
青春惊慌失措 2020-12-19 04:43

I read book < C++ Templates - the Complete Guide > and learned template specialization for pointer. (maybe I misunderstand this part of the book)

(1) Here\'s my s

3条回答
  •  梦毁少年i
    2020-12-19 05:20

    Two problems:

    1. You are not allowed to partially specialise a function.

    2. The behaviour of (void*)0x25 is undefined. With the exception of nullptr, you are not allowed to set a pointer to memory you don't own, with the exception of one past the final element of an array and one past the address of a scalar.

提交回复
热议问题