title: Make All Types Constant by Default in C++
body: <p>What is the simplest and least obtrusive way to indicate to the compiler, whether by means of compiler options, <code>#define</code>s, <code>typedef</code>s, or templates, that every time I say <code>T</code>, I really mean <code>T const</code>? I would prefer not to make use of an external preprocessor. Since I don't use the <code>mutable</code> keyword, that would be acceptable to repurpose to indicate mutable state.</p>
  
  <p><strong>Edit:</strong> Since the intent of this was mistaken <em>entirely</em> (and since I wasn't around for a few hours to clarify), let me explain. In essence, I just want to know what systems are available for manipulating the type system at compile time. I don't care if this creates nonstandard, bad, unmaintainable, useless code. I'm not going to use it in production. It's just a curiosity.</p>
  
  <p>Potential (suboptimal) solutions so far:</p>
  
  <pre><code>// I presume redefinition of keywords is implementation-defined or illegal.
  #define int int const
  #define ptr * const
  int i(0);
  int ptr j(&amp;i);
  
  typedef int const Int;
  typedef int const* const Intp;
  Int i(0);
  Intp j(&amp;i);
  
  template&lt;class T&gt;
  struct C { typedef T const type; typedef T const* const ptr; };
  C&lt;int&gt;::type i(0);
  C&lt;int&gt;::ptr j(&amp;i);
  </code></pre>