title: Is it possible to put lambda expressions into a map or list in C++?
body: <p>@DanielLangr @luxun @cdhowie sorry for the XY problem. i am not sure i can explain well, but i try my best. the situation is almost like this: there is a base object "Worker" and some children. chef、tailor... children has the same action like walk、run、sleep...but different skill,chef can make food, tailor can Make clothes. Invoker call Worker dothings but do not exactly know their profession.so i add a interface dothings(Thing) on Worker the base object. Thing is an enum,value is MakeFood、MakeClothes...</p>
  
  <pre><code>Worker *w = new Chef();
  w-&gt;dothings(MakeFood);//
  w-&gt;dothings(MakeClothes);//throw exception "w do not have skill"
  </code></pre>
  
  <p>so i think meybe use a container in children that describe what it can do and how to do.</p>
  
  <p>hope i explained clearly.and is there a better solution?</p>
  
  <p>I want to put different lambda expressions into a list or Qmap, like below.</p>
  
  <pre><code>Qmap&lt;String, lambda&gt; map;
  map.insert("first",[](int i) -&gt; int {return i;});
  map.insert("second",[](string s) -&gt; string {return s;});
  </code></pre>
  
  <p>Is it possible in C++? And what is the type of lambda?</p>