Home Blog/Rants Downloads C++ Papers GitHub LinkedIn
Michael-Maniscalco.com
Blog/Rants
Where I've been ...
February 10, 2017
When I was a boy, roughly five years old, a neighborhood bully burned the back of my right hand with a red hot cigarette lighter from a car console. It burned my young skin producing a round and black blister that felt as cold as ice. I never think about it. But tonight, in a dark room illuminated only by the light of the computer monitor, I did. When I looked at it I did not think of anger or hate. I only saw character.

Some crazy C++ shiznit
January 11, 2017
If you wanted to encapsulate a reference to a C++ const character array and provide the ability to access that value without it decaying to a char const * you would write something like the following. How's this for crazy-assed C++ syntax?!
template <std::size_t N>
class const_char_array_wrapper
{
public:
   
    const_char_array_wrapper
    (
        char const (&value)[N]
    ):
        value_(value)
    {
    }

    char const
    (
        & get_value() const
    )[N]
    {
        return value_;
    }

    // or, for implicit conversions

    (
        & operator char const () const
    )[N]
    {
        return value_;
    }

private:

  char const (&value_)[N];
};