I am learning about C++20 ranges and came across this term "customization point object". I learned and understand that it is a const
semiregular
function object used for solving customization dispatch from Barry's C++ blog about Niebloids and Customization Point Objects and What are customization point objects and how to use them?.
With this understanding, I thought "customization point" as "the generic code that is customizable by user". For example, function template std::swap
is a "customization point" since we as user can write customized function overloads with specific types.
But today when I read C++ standard library design guidelines, I found this:
Make it clear what the customization points are.
Then I doubted my understanding about "customization point" might be wrong, since if customization point is just "generic code like templates", then why do we need to "make it clear" since the definition of template is already clear? Is the meaning of "customization point" something else?
I also found how Eric Niebler defines customization point in Eric Niebler's blog: Customization Point Design in C++11 and Beyond:
hooks used by generic code that end-users can specialize to customize the behavior for their types.
I am not a native English speaker and I am not sure I understand this definition, here is my two guesses:
- for function template
std::swap
, the customization point is notstd::swap
itself, it is the template parameters (which in this case, type), it is the thing that we specialize to create a customization version from the standard version. - customization point is just the customization version from the standard version, like if we define
swap(MyType t1, MyType t2)
, then this customized definition is the customization point.
Do I get the right understanding with either of these two? What is the clear definition of "customization point"? And why "customization point object", as a function object used to circumvent ADL, is called "customization point object"?