Skip to content

Instantly share code, notes, and snippets.

@tebriel
Created April 10, 2012 03:21
Show Gist options
  • Save tebriel/2348138 to your computer and use it in GitHub Desktop.
Save tebriel/2348138 to your computer and use it in GitHub Desktop.
C++ STL Stuff
1>------ Build started: Project: Cheetah, Configuration: Debug Win32 ------
1> BoxOfficeFile.cpp
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\algorithm(2944): error C2664: 'bool perf_itr_number_pred::operator ()(std::_Vector_iterator<_Myvec>,std::_Vector_iterator<_Myvec>)' : cannot convert parameter 1 from 'CPerformance *const ' to 'std::_Vector_iterator<_Myvec>'
1> with
1> [
1> _Myvec=std::_Vector_val<std::_Simple_types<CPerformance>>
1> ]
1> No constructor could take the source type, or constructor overload resolution was ambiguous
1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\algorithm(2968) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2> std::_Equal_range<std::_Vector_iterator<_Myvec>*,_Ty,__w64 int,_Pr>(_FwdIt,_FwdIt,const _Ty &,_Pr,_Diff *)' being compiled
1> with
1> [
1> _Ty1=std::_Get_unchecked_type<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<CPerformance>>>>>>>::type,
1> _Ty2=std::_Get_unchecked_type<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<CPerformance>>>>>>>::type,
1> _Myvec=std::_Vector_val<std::_Simple_types<CPerformance>>,
1> _Ty=CPerformance *,
1> _Pr=perf_itr_number_pred,
1> _FwdIt=std::_Vector_iterator<std::_Vector_val<std::_Simple_types<CPerformance>>> *,
1> _Diff=__w64 int
1> ]
1> c:\storage\tfs\kioskvs2010\boxofficefile.cpp(1423) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2> std::equal_range<std::_Vector_iterator<_Myvec>,CPerformance*,perf_itr_number_pred>(_FwdIt,_FwdIt,const _Ty &,_Pr)' being compiled
1> with
1> [
1> _Ty1=std::_Vector_iterator<std::_Vector_val<std::_Simple_types<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<CPerformance>>>>>>,
1> _Ty2=std::_Vector_iterator<std::_Vector_val<std::_Simple_types<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<CPerformance>>>>>>,
1> _Myvec=std::_Vector_val<std::_Simple_types<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<CPerformance>>>>>,
1> _FwdIt=std::_Vector_iterator<std::_Vector_val<std::_Simple_types<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<CPerformance>>>>>>,
1> _Ty=CPerformance *,
1> _Pr=perf_itr_number_pred
1> ]
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
CPerformance * CBoxOfficeFile::GetPerformanceInfo( const int iPerformanceId )
{
if( false == m_PerformanceByNumVec.empty() )
{
std::pair< TPerformanceItrVec::iterator, TPerformanceItrVec::iterator > range_pair;
CPerformance perf( iPerformanceId );
range_pair = std::equal_range( m_PerformanceByNumVec.begin(),
m_PerformanceByNumVec.end(),
&perf,
perf_itr_number_pred() );
if( range_pair.first != range_pair.second )
{
return( (CPerformance*) &range_pair.first );
}
}
return( NULL );
}
typedef std::vector< CPerformance > TPerformanceVec;
typedef std::vector< TPerformanceVec::iterator > TPerformanceItrVec;
typedef TPerformanceVec::iterator TPerformanceItrVecItr;
struct perf_itr_number_pred : public std::binary_function< TPerformanceItrVec::value_type, TPerformanceItrVec::value_type, bool >
{
public:
result_type operator() (first_argument_type one, second_argument_type two)
{
return( one->m_Index < two->m_Index );
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment