Talk:cpp/language/explicit
From cppreference.com
[edit] static_cast
It should be used either static_cast or int() in both A and B examples.
I think int() makes it more readable, is there any reason to use static_cast?
-- Bazzy 15:07, 13 March 2012 (PDT)
- C-style cast is too generic to be useful (except when you're implementing std::addressof or offsetof). Especially when the purpose is to explain something. Editing to static cast --Cubbi 19:02, 13 March 2012 (PDT)
[edit] structures without member variables
Is there a reason the structs in the examples do not have member variables? Does it make it a better example? Arbalest 14:47, 14 December 2012 (PST)
- It's to keep the example as minimal as possible. The definition of the structs is not really relevant.
- The example is there just to show what would compile and what not.
- --Bazzy 15:05, 14 December 2012 (PST)