title: boost::function parameter definition not working
body: <p>I created two special types that I want to use in my get_property_function.hpp in my application:</p>
  
  <pre><code>typedef boost::function&lt;std::string ()&gt; GetFunction;
  typedef map&lt;std::string, GetFunction&gt; PropertyToGetFunction;
  
  typedef boost::function&lt;std::string (LPARAM)&gt; GetEventFunction;
  typedef map&lt;std::string, GetEventFunction&gt; PropertyToGetEventFunction;
  </code></pre>
  
  <p>I define the following lines in my PropertyManager.hpp:</p>
  
  <pre><code>PropertyToGetFunction create_get_map();
  PropertyToGetEventFunction create_event_get_map();
  
  PropertyToGetFunction property2getFunction;
  PropertyToGetEventFunction property2getEventFunction;
  </code></pre>
  
  <p>I implement them in my PropertyManager.cpp:</p>
  
  <pre><code>PropertyToGetFunction PropertyManager::create_get_map()
  {
      PropertyToGetFunction property2getFunction;
  
  
      property2getFunction[string("1.1.3.4.1.1")]=&amp;getReceiptPrinter_DeviceCapability;
  
          ...
  
      return property2getFunction;
  }
  
  PropertyToGetEventFunction PropertyManager::create_event_get_map()
  {
      PropertyToGetEventFunction property2getEventFunction;
  
      property2getEventFunction[string("105")]=&amp;getPTRRetractBinThreshold_UserEvent;
  
          ...
  
      return property2getEventFunction;
  }
  </code></pre>
  
  <p>The methods I assigned to my map are defined in <code>get_property_function</code>.</p>
  
  <p>get_property_function.hpp:</p>
  
  <pre><code>...
  std::string getPTRRetractBinThreshold_UserEvent(LPARAM lParam);
  ...
  </code></pre>
  
  <p>get_property_function.cpp:</p>
  
  <pre><code>...
  std::string getPTRRetractBinThreshold_UserEvent(LPARAM lParam)
  {
      string result = "";
  
      //I will do some process in here and will save it in result var.
  
      return result;
  }
  ...
  </code></pre>
  
  <p>I use <code>getPropertyValue</code> to find the correct method in my map:</p>
  
  <pre><code>string PropertyManager::getPropertyValue(string property_id)
  {   
      string result_value = "No Property Found";
  
      if (!isReadable(property_id))
      {
          return "Error";
      }
      else
      {
          PropertyToGetFunction::const_iterator it =property2getFunction.find(property_id);
  
          if ( it != property2getFunction.end() )
          {       
              GetFunction function = it-&gt;second;
              result_value = function();
          }
      }
  
      return result_value;
  }
  
  string PropertyManager::getPropertyValue(string property_id, LPARAM lParam)
  {   
      string result_value = "No Property Found";
  
      if (!isReadable(property_id))
      {
          return "Error";
      }
      else
      {
          PropertyToGetEventFunction::const_iterator it = property2getEventFunction.find(property_id);
  
          if ( it != property2getEventFunction.end() )
          {       
              GetEventFunction function = it-&gt;second;
              result_value = function(lParam);
          }
      }
  
      return result_value;
  }
  </code></pre>
  
  <p><code>getPropertyValue(string property_id)</code> is working fine and I have no problems with that, but the <code>getPropertyValue(string property_id, LPARAM lParam)</code> causes a compile error:</p>
  
  <pre><code>1&gt;        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\istream(1144): could be 'std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::operator &gt;&gt;&lt;std::char_traits&lt;char&gt;&gt;(std::basic_istream&lt;_Elem,_Traits&gt; &amp;,signed char *)' [found using argument-dependent lookup]
  1&gt;        with
  1&gt;        [
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;
  1&gt;        ]
  1&gt;        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\istream(1146): or       'std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::operator &gt;&gt;&lt;std::char_traits&lt;char&gt;&gt;(std::basic_istream&lt;_Elem,_Traits&gt; &amp;,signed char &amp;)' [found using argument-dependent lookup]
  1&gt;        with
  1&gt;        [
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;
  1&gt;        ]
  1&gt;        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\istream(1148): or       'std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::operator &gt;&gt;&lt;std::char_traits&lt;char&gt;&gt;(std::basic_istream&lt;_Elem,_Traits&gt; &amp;,unsigned char *)' [found using argument-dependent lookup]
  1&gt;        with
  1&gt;        [
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;
  1&gt;        ]
  1&gt;        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\istream(1150): or       'std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::operator &gt;&gt;&lt;std::char_traits&lt;char&gt;&gt;(std::basic_istream&lt;_Elem,_Traits&gt; &amp;,unsigned char &amp;)' [found using argument-dependent lookup]
  1&gt;        with
  1&gt;        [
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;
  1&gt;        ]
  1&gt;        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\istream(155): or       'std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::basic_istream&lt;_Elem,_Traits&gt;::operator &gt;&gt;(std::basic_istream&lt;_Elem,_Traits&gt; &amp;(__cdecl *)(std::basic_istream&lt;_Elem,_Traits&gt; &amp;))'
  1&gt;        with
  1&gt;        [
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;
  1&gt;        ]
  1&gt;        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\istream(161): or       'std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::basic_istream&lt;_Elem,_Traits&gt;::operator &gt;&gt;(std::basic_ios&lt;_Elem,_Traits&gt; &amp;(__cdecl *)(std::basic_ios&lt;_Elem,_Traits&gt; &amp;))'
  1&gt;        with
  1&gt;        [
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;
  1&gt;        ]
  1&gt;        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\istream(168): or       'std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::basic_istream&lt;_Elem,_Traits&gt;::operator &gt;&gt;(std::ios_base &amp;(__cdecl *)(std::ios_base &amp;))'
  1&gt;        with
  1&gt;        [
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;
  1&gt;        ]
  1&gt;        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\istream(175): or       'std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::basic_istream&lt;_Elem,_Traits&gt;::operator &gt;&gt;(std::_Bool &amp;)'
  1&gt;        with
  1&gt;        [
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;
  1&gt;        ]
  1&gt;        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\istream(194): or       'std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::basic_istream&lt;_Elem,_Traits&gt;::operator &gt;&gt;(short &amp;)'
  1&gt;        with
  1&gt;        [
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;
  1&gt;        ]
  1&gt;        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\istream(228): or       'std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::basic_istream&lt;_Elem,_Traits&gt;::operator &gt;&gt;(unsigned short &amp;)'
  1&gt;        with
  1&gt;        [
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;
  1&gt;        ]
  1&gt;        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\istream(247): or       'std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::basic_istream&lt;_Elem,_Traits&gt;::operator &gt;&gt;(int &amp;)'
  1&gt;        with
  1&gt;        [
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;
  1&gt;        ]
  1&gt;        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\istream(273): or       'std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::basic_istream&lt;_Elem,_Traits&gt;::operator &gt;&gt;(unsigned int &amp;)'
  1&gt;        with
  1&gt;        [
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;
  1&gt;        ]
  1&gt;        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\istream(291): or       'std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::basic_istream&lt;_Elem,_Traits&gt;::operator &gt;&gt;(long &amp;)'
  1&gt;        with
  1&gt;        [
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;
  1&gt;        ]
  1&gt;        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\istream(309): or       'std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::basic_istream&lt;_Elem,_Traits&gt;::operator &gt;&gt;(__w64 unsigned long &amp;)'
  1&gt;        with
  1&gt;        [
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;
  1&gt;        ]
  1&gt;        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\istream(329): or       'std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::basic_istream&lt;_Elem,_Traits&gt;::operator &gt;&gt;(__int64 &amp;)'
  1&gt;        with
  1&gt;        [
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;
  1&gt;        ]
  1&gt;        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\istream(348): or       'std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::basic_istream&lt;_Elem,_Traits&gt;::operator &gt;&gt;(unsigned __int64 &amp;)'
  1&gt;        with
  1&gt;        [
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;
  1&gt;        ]
  1&gt;        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\istream(367): or       'std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::basic_istream&lt;_Elem,_Traits&gt;::operator &gt;&gt;(float &amp;)'
  1&gt;        with
  1&gt;        [
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;
  1&gt;        ]
  1&gt;        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\istream(386): or       'std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::basic_istream&lt;_Elem,_Traits&gt;::operator &gt;&gt;(double &amp;)'
  1&gt;        with
  1&gt;        [
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;
  1&gt;        ]
  1&gt;        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\istream(404): or       'std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::basic_istream&lt;_Elem,_Traits&gt;::operator &gt;&gt;(long double &amp;)'
  1&gt;        with
  1&gt;        [
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;
  1&gt;        ]
  1&gt;        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\istream(422): or       'std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::basic_istream&lt;_Elem,_Traits&gt;::operator &gt;&gt;(void *&amp;)'
  1&gt;        with
  1&gt;        [
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;
  1&gt;        ]
  1&gt;        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\istream(441): or       'std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::basic_istream&lt;_Elem,_Traits&gt;::operator &gt;&gt;(std::basic_streambuf&lt;_Elem,_Traits&gt; *)'
  1&gt;        with
  1&gt;        [
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;
  1&gt;        ]
  1&gt;        while trying to match the argument list '(std::basic_istream&lt;_Elem,_Traits&gt;, LPWORD )'
  1&gt;        with
  1&gt;        [
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;
  1&gt;        ]
  1&gt;        D:\programming\agent\compiled4vs2008\boost_v1.50.0\include\boost-1_50\boost/property_tree/stream_translator.hpp(35) : while compiling class template member function 'void boost::property_tree::customize_stream&lt;Ch,Traits,E&gt;::extract(std::basic_istream&lt;_Elem,_Traits&gt; &amp;,E &amp;)'
  1&gt;        with
  1&gt;        [
  1&gt;            Ch=char,
  1&gt;            Traits=std::char_traits&lt;char&gt;,
  1&gt;            E=LPWORD ,
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;
  1&gt;        ]
  1&gt;        D:\programming\agent\compiled4vs2008\boost_v1.50.0\include\boost-1_50\boost/property_tree/stream_translator.hpp(190) : see reference to class template instantiation 'boost::property_tree::customize_stream&lt;Ch,Traits,E&gt;' being compiled
  1&gt;        with
  1&gt;        [
  1&gt;            Ch=char,
  1&gt;            Traits=std::char_traits&lt;char&gt;,
  1&gt;            E=LPWORD 
  1&gt;        ]
  1&gt;        D:\programming\agent\compiled4vs2008\boost_v1.50.0\include\boost-1_50\boost/property_tree/stream_translator.hpp(186) : while compiling class template member function 'boost::optional&lt;T&gt; boost::property_tree::stream_translator&lt;Ch,Traits,Alloc,E&gt;::get_value(const std::basic_string&lt;_Elem,_Traits,_Ax&gt; &amp;)'
  1&gt;        with
  1&gt;        [
  1&gt;            T=LPWORD ,
  1&gt;            Ch=char,
  1&gt;            Traits=std::char_traits&lt;char&gt;,
  1&gt;            Alloc=std::allocator&lt;char&gt;,
  1&gt;            E=LPWORD ,
  1&gt;            _Elem=char,
  1&gt;            _Traits=std::char_traits&lt;char&gt;,
  1&gt;            _Ax=std::allocator&lt;char&gt;
  1&gt;        ]
  1&gt;        D:\programming\agent\compiled4vs2008\boost_v1.50.0\include\boost-1_50\boost/property_tree/detail/ptree_implementation.hpp(661) : see reference to class template instantiation 'boost::property_tree::stream_translator&lt;Ch,Traits,Alloc,E&gt;' being compiled
  1&gt;        with
  1&gt;        [
  1&gt;            Ch=char,
  1&gt;            Traits=std::char_traits&lt;char&gt;,
  1&gt;            Alloc=std::allocator&lt;char&gt;,
  1&gt;            E=LPWORD 
  1&gt;        ]
  1&gt;        D:\programming\agent\compiled4vs2008\boost_v1.50.0\include\boost-1_50\boost/property_tree/detail/ptree_implementation.hpp(732) : see reference to function template instantiation 'Type boost::property_tree::basic_ptree&lt;Key,Data&gt;::get_value&lt;Type&gt;(void) const' being compiled
  1&gt;        with
  1&gt;        [
  1&gt;            Type=LPWORD,
  1&gt;            Key=std::string,
  1&gt;            Data=std::string
  1&gt;        ]
  1&gt;        ..\..\..\..\..\..\..\Source-Code\Device-Manager\source\property\get_property_functions.cpp(3328) : see reference to function template instantiation 'Type boost::property_tree::basic_ptree&lt;Key,Data&gt;::get&lt;LPWORD&gt;(const boost::property_tree::string_path&lt;String,Translator&gt; &amp;) const' being compiled
  1&gt;        with
  1&gt;        [
  1&gt;            Type=LPWORD,
  1&gt;            Key=std::string,
  1&gt;            Data=std::string,
  1&gt;            String=std::string,
  1&gt;            Translator=boost::property_tree::id_translator&lt;std::string&gt;
  1&gt;        ]
  </code></pre>
  
  <p>I'm sure there is something wrong with my parameter definition in <code>boost::function</code>. Can you tell me what I do wrong?</p>