OSX.6에서 i686-apple-darwin10-gcc-4.2.1 컴파일러를 사용하고 있습니다. (10.5를 업그레이드하고 이월했습니다. 이전의 dev 툴킷). 나는 내 구현이 라이브러리를 포함하고있어boost :: bind를 사용하여 boost :: tuple 요소에 액세스 할 수 없습니다.
:
std::vector<myTupleType> theTupleVector;
:
typedef boost::tuple<double, unsigned long, unsigned long, char> myTupleType;
나는 그런 튜플의 벡터가 있습니다
#include <vector>
#include <boost/bind.hpp>
#include <boost/tuple/tuple.hpp>
I는 다음과 같습니다 튜플이
값을 검색해야하는 메서드가 있습니다.
template <typename T,int i>
class accessTupleElement
{
public:
typedef typename boost::tuples::element<i,T>::type result_type;
template <typename U> result_type operator()(const U& u) const
{
// Select the ith element of the tuple T and return it
return boost::get<i>(u);
}
};
나는 다음과 같은 놀라운 일을하려고 :
std::find_if(startIter, endIter, boost::bind(std::equal<unsigned long>, boost::bind(accessTupleElement<myTupleType, 1>(), _1), 123L));
는 startIter 및 endIter는 시작과 튜플 내 벡터의 끝입니다. 나는 이것이 반복자의 값으로 함수 객체를 묶고, 튜플의 원하는 값으로 평가하고 그것을 123과 비교할 것이라고 추정 할 것이다.
내 속박에 관한 다음과 같은 오류 메시지가 발생했다. :
no matching function for call to 'bind(<unresolved overloaded function type>, boost::_bi::bind_t<boost::_bi::unspecified, accessTupleElement<boost::tuples::tuple<double, long unsigned int, long unsigned int, char, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type>, 1>, boost::_bi::list1<boost::arg<1> > >, boost::arg<2>&)'
나는 어떻게 컴파일러가 혼란에 빠질 수 있습니까? accessTupleElement라는 식별자가 하나 뿐이므로이 문제를 해결할 수있는 모든 인터넷 문서와 부스트를 따라했습니다. 어떻게 해결 되나요?
는 매우 특정 있습니까?은 의심 스러우며'std :: equal '을 참조합니다. –
어떻게하면 std :: equal을 참조 할 수 있습니까? 오류를 잘못 읽었습니까? –
@Matthew 두 번째 인수의 타입 ('boost :: _ bi :: bind_t')이 내부 'bind'의 리턴 타입과 비슷하기 때문에. –