title: How do I loop over a boost MPL list of non-default constructed classes?
body: <p>I have the following example:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;iostream&gt;
  
  #include &lt;boost/mpl/for_each.hpp&gt;
  #include &lt;boost/mpl/list.hpp&gt;
  
  struct one {};
  struct two {};
  struct three {};
  struct four {};
  struct five { five() = delete; };
  
  template &lt;typename T&gt;
  void print()
  {
    std::cout &lt;&lt; "hello " &lt;&lt; typeid(T).name() &lt;&lt; std::endl;
  }
  
  struct type_printer
  {
    template &lt;typename T&gt;
    void operator()(T)
    {
      print&lt;T&gt;();
    }
  };
  
  int main()
  {
    typedef boost::mpl::list&lt;
      one,
      two,
      three,
      four,
      five
    &gt;::type type_list;
  
    boost::mpl::for_each&lt;type_list&gt;(type_printer());
  }
  </code></pre>
  
  <p>Which works absolutely fine if I don't include the fifth object in the list, but once I do I get the following errors:</p>
  
  <pre><code>In file included from /usr/local/include/boost_1_56_0/boost/mpl/for_each.hpp:29:0,
                   from mpldef.cpp:3:
  /usr/local/include/boost_1_56_0/boost/utility/value_init.hpp: In constructor ‘boost::initialized&lt;T&gt;::wrapper::wrapper() [with T = five]’:
  /usr/local/include/boost_1_56_0/boost/utility/value_init.hpp:109:7:   instantiated from ‘boost::initialized&lt;T&gt;::initialized() [with T = five]’
  /usr/local/include/boost_1_56_0/boost/utility/value_init.hpp:205:12:   instantiated from ‘boost::value_initialized&lt;T&gt;::value_initialized() [with T = five]’
  /usr/local/include/boost_1_56_0/boost/mpl/for_each.hpp:81:9:   recursively instantiated from ‘static void boost::mpl::aux::for_each_impl&lt;false&gt;::execute(Iterator*, LastIterator*, TransformFunc*, F) [with Iterator = boost::mpl::l_iter&lt;boost::mpl::list4&lt;two, three, four, five&gt; &gt;, LastIterator = boost::mpl::l_iter&lt;boost::mpl::l_end&gt;, TransformFunc = boost::mpl::identity&lt;mpl_::na&gt;, F = type_printer]’
  /usr/local/include/boost_1_56_0/boost/mpl/for_each.hpp:81:9:   instantiated from ‘static void boost::mpl::aux::for_each_impl&lt;false&gt;::execute(Iterator*, LastIterator*, TransformFunc*, F) [with Iterator = boost::mpl::l_iter&lt;boost::mpl::list5&lt;one, two, three, four, five&gt; &gt;, LastIterator = boost::mpl::l_iter&lt;boost::mpl::l_end&gt;, TransformFunc = boost::mpl::identity&lt;mpl_::na&gt;, F = type_printer]’
  /usr/local/include/boost_1_56_0/boost/mpl/for_each.hpp:104:5:   instantiated from ‘void boost::mpl::for_each(F, Sequence*, TransformOp*) [with Sequence = boost::mpl::list5&lt;one, two, three, four, five&gt;, TransformOp = boost::mpl::identity&lt;mpl_::na&gt;, F = type_printer]’
  /usr/local/include/boost_1_56_0/boost/mpl/for_each.hpp:118:3:   instantiated from ‘void boost::mpl::for_each(F, Sequence*) [with Sequence = boost::mpl::list5&lt;one, two, three, four, five&gt;, F = type_printer]’
  mpldef.cpp:37:48:   instantiated from here
  /usr/local/include/boost_1_56_0/boost/utility/value_init.hpp:77:12: error: use of deleted function ‘five::five()’
  mpldef.cpp:10:15: error: declared here
  </code></pre>
  
  <p>Is there any way of doing this? I tried removing <code>T</code> from the <code>type_printer</code> call operator, so it looked something like this: <code>void operator()()</code> and I still got the same error.</p>