Hi,
I have the following definition of the classes
class DataRecordMap
{
private:
typedef boost::shared_ptr<const DataRecord >
DataRecordPtr;
typedef std::pair key_type;
typedef double value_type;
struct keyComp
{
bool operator() (const DataRecordMap::key_type
&lhs,
const
DataRecordMap::key_type &rhs) const;
};
private:
typedef std::map map_type;
const std::vector m_index;
map_type m_records;
public:
DataRecordMap(const std::vector &idx);
void add(DataRecordPtr secondKey, double value);
double operator[] (const DataRecord &value) const;
double& operator[] (const DataRecord &secondKey);
friend std::ostream& operator << (std::ostream& out, const
DataRecordMap &records);
};
Then it fails to compile on this implementation:
double DataRecordMap::operator[] (const DataRecord &secondKey) const
{
std::string firstKey(secondKey.compareKey(m_index)->signature());
map_type::const_iterator findIt(std::find_if(m_records.begin(),
m_records.end(),
boost::bind(&map_type::key_type::first, _1) == firstKey));
if(findIt==m_records.end())
THROW_EXCEPTION("Key " << firstKey << " not found in the
data records");
return (*findIt).second;
}
Could someone please help me with it? The error is:
1>------ Build started: Project: compare, Configuration: Debug Win32
------
1>Compiling...
1>diffTool.cpp
1>d:\dev\soho_new\thirdparty\boost\bind\mem_fn.hpp(333) : error C2784: 'T
*boost::get_pointer(const boost::shared_ptr<X> &)' : could not deduce
template argument for 'const boost::shared_ptr<X> &' from 'const
std::pair<_Ty1,_Ty2>'
1> with
1> [
1> _Ty1=const `anonymous-namespace'::DataRecordMap::key_type,
1> _Ty2=`anonymous-namespace'::DataRecordMap::value_type
1> ]
1> d:\dev\soho_new\thirdparty\boost\smart_ptr\shared_ptr.hpp(550) :
see declaration of 'boost::get_pointer'
1> d:\dev\soho_new\thirdparty\boost\bind\mem_fn.hpp(352) : see
reference to function template instantiation 'const R
&boost::_mfi::dm::call<const U>(U &,const void *) const' being
compiled
1> with
1> [
1> R=std::string,
1>
T=std::pairstd::string,`anonymous-namespace'::DataRecordMap::DataRecordPtr,
1> U=std::pair
1> ]
1> d:\dev\soho_new\thirdparty\boost\bind\bind.hpp(243) : see
reference to function template instantiation 'const R
&boost::_mfi::dm::operator ()<A1>(const U &) const' being compiled
1> with
1> [
1> R=std::string,
1>
T=std::pairstd::string,`anonymous-namespace'::DataRecordMap::DataRecordPtr,
1> A1=std::pair,
1> U=std::pair
1> ]
1> d:\dev\soho_new\thirdparty\boost\bind\bind_template.hpp(318) :
see reference to function template instantiation 'R
boost::_bi::list1<A1>::operator ()&,F,A>(boost::_bi::type<T>,F &,A
&,long)' being compiled
1> with
1> [
1> R=const
std::basic_string &,
1> A1=boost::arg<1>,
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>,
1>
F=boost::_mfi::dmstd::string,`anonymous-namespace'::DataRecordMap::DataRecordPtr>,
1> A=const boost::_bi::list1
&>,
1> T=const
std::basic_string &
1> ]
1> d:\dev\soho_new\thirdparty\boost\bind\bind.hpp(237) : see
reference to function template instantiation 'const
std::basic_string<_Elem,_Traits,_Ax>
&boost::_bi::bind_t::eval(A &)' being
compiled
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>,
1> R=const
std::basic_string &,
1>
F=boost::_mfi::dmstd::string,`anonymous-namespace'::DataRecordMap::DataRecordPtr>,
1> L=boost::_bi::list1>,
1> A1=const std::pair
&,
1> A=const boost::_bi::list1
&>
1> ]
1> d:\dev\soho_new\thirdparty\boost\bind\bind.hpp(303) : see
reference to function template instantiation 'const
std::basic_string<_Elem,_Traits,_Ax> &boost::_bi::list1<A1>::operator
[]&,boost::_mfi::dm,boost::_bi::list1>(boost::_bi::bind_t &,F,L> &) const' being compiled
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>,
1> A1=const std::pair
&,
1> R=std::string,
1>
T=std::pairstd::string,`anonymous-namespace'::DataRecordMap::DataRecordPtr,
1> I=1,
1>
F=boost::_mfi::dmstd::string,`anonymous-namespace'::DataRecordMap::DataRecordPtr>,
1> L=boost::_bi::list1>
1> ]
1> d:\dev\soho_new\thirdparty\boost\bind\bind_template.hpp(47) :
see reference to function template instantiation 'R
boost::_bi::list2::operator () &>>(boost::_bi::type<T>,F &,A &,long)' being compiled
1> with
1> [
1> R=bool,
1> A1=boost::_bi::bind_t
&,boost::_mfi::dmstd::string,`anonymous-namespace'::DataRecordMap::DataRecordPtr>,boost::_bi::list1>>,
1> A2=boost::_bi::valuestd::string,
1> F=boost::_bi::equal,
1> _Ty1=const `anonymous-namespace'::DataRecordMap::key_type,
1> _Ty2=`anonymous-namespace'::DataRecordMap::value_type,
1> T=bool,
1> A=boost::_bi::list1
&>
1> ]
1> c:\program files\microsoft visual studio
8\vc\include\algorithm(87) : see reference to function template
instantiation 'bool boost::_bi::bind_t::operator
()>(const A1 &)' being compiled
1> with
1> [
1> R=bool,
1> F=boost::_bi::equal,
1> L=boost::_bi::list2
&,boost::_mfi::dmstd::string,`anonymous-namespace'::DataRecordMap::DataRecordPtr>,boost::_bi::list1>>,boost::_bi::valuestd::string>,
1> _Ty1=const `anonymous-namespace'::DataRecordMap::key_type,
1> _Ty2=`anonymous-namespace'::DataRecordMap::value_type,
1> A1=std::pair
1> ]
1> c:\program files\microsoft visual studio
8\vc\include\algorithm(96) : see reference to function template
instantiation '_InIt
std::_Find_if::const_iterator,_Pr>(_InIt,_InIt,_Pr)'
being compiled
1> with
1> [
1>
_InIt=std::_Tree>,false>>::const_iterator,
1>
_Traits=std::_Tmap_traits<`anonymous-namespace'::DataRecordMap::key_type,`anonymous-namespace'::DataRecordMap::value_type,`anonymous-namespace'::DataRecordMap::keyComp,std::allocator>,false>,
1>
_Pr=boost::_bi::bind_t
&,boost::_mfi::dmstd::string,`anonymous-namespace'::DataRecordMap::DataRecordPtr>,boost::_bi::list1>>,boost::_bi::valuestd::string>>
1> ]
1> d:\dev\ownprogs\compare\compare\difftool.cpp(166) : see
reference to function template instantiation '_InIt
std::find_if::const_iterator,boost::_bi::bind_t>(_InIt,_InIt,_Pr)'
being compiled
1> with
1> [
1>
_InIt=std::_Tree>,false>>::const_iterator,
1>
_Traits=std::_Tmap_traits<`anonymous-namespace'::DataRecordMap::key_type,`anonymous-namespace'::DataRecordMap::value_type,`anonymous-namespace'::DataRecordMap::keyComp,std::allocator>,false>,
1> R=bool,
1> F=boost::_bi::equal,
1> L=boost::_bi::list2
&,boost::_mfi::dmstd::string,`anonymous-namespace'::DataRecordMap::DataRecordPtr>,boost::_bi::list1>>,boost::_bi::valuestd::string>,
1>
_Pr=boost::_bi::bind_t
&,boost::_mfi::dmstd::string,`anonymous-namespace'::DataRecordMap::DataRecordPtr>,boost::_bi::list1>>,boost::_bi::valuestd::string>>
1> ]
1>d:\dev\soho_new\thirdparty\boost\bind\mem_fn.hpp(333) : error C2784: 'T
*boost::get_pointer(const std::auto_ptr<_Ty> &)' : could not deduce
template argument for 'const std::auto_ptr<_Ty> &' from 'const
std::pair<_Ty1,_Ty2>'
1> with
1> [
1> _Ty1=const `anonymous-namespace'::DataRecordMap::key_type,
1> _Ty2=`anonymous-namespace'::DataRecordMap::value_type
1> ]
1> d:\dev\soho_new\thirdparty\boost\get_pointer.hpp(25) : see
declaration of 'boost::get_pointer'
1>d:\dev\soho_new\thirdparty\boost\bind\mem_fn.hpp(333) : error C2784: 'T
*boost::get_pointer(T *)' : could not deduce template argument for 'T *'
from 'const std::pair<_Ty1,_Ty2>'
1> with
1> [
1> _Ty1=const `anonymous-namespace'::DataRecordMap::key_type,
1> _Ty2=`anonymous-namespace'::DataRecordMap::value_type
1> ]
1> d:\dev\soho_new\thirdparty\boost\get_pointer.hpp(18) : see
declaration of 'boost::get_pointer'
1>d:\dev\soho_new\thirdparty\boost\bind\mem_fn.hpp(333) : error C2784: 'T
*boost::get_pointer(const boost::reference_wrapper<T> &)' : could not
deduce template argument for 'const boost::reference_wrapper<T> &' from
'const std::pair<_Ty1,_Ty2>'
1> with
1> [
1> _Ty1=const `anonymous-namespace'::DataRecordMap::key_type,
1> _Ty2=`anonymous-namespace'::DataRecordMap::value_type
1> ]
1> d:\dev\soho_new\thirdparty\boost\ref.hpp(182) : see declaration
of 'boost::get_pointer'
1>Build log was saved at
"file://d:\Dev\OwnProgs\compare\compare\Debug\BuildLog.htm"
1>compare - 4 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
==========
___________________________________________________________
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is prohibited.
Please refer to http://www.bnpparibas.co.uk/en/information/legal_information.asp?Code=ECAS-8... for additional disclosures.