Boost logo

Boost Users :

Subject: Re: [Boost-users] using boost::tokenizer within boost::bimap
From: Vaclav Haisman (v.haisman_at_[hidden])
Date: 2008-11-01 05:53:46


Sean Farrow wrote:
> Hi:
> I'd like to use boost::tokenizer in boost::bimap.
> I currently have:
> boost::bimaps::bimap<boost::bimaps::unordered_set_of<boost::tokenizer<bo
> ost::char_separator<char>>>, std::string> CodeList;
>
> I'm getting the following errors:
>
> 1>------ Build started: Project: VDux, Configuration: Release Win32
> ------
>
> 1>Compiling...
>
> 1>VDux.cpp
>
> 1>c:\program files\boost\boost/functional/hash/extensions.hpp(72) :
> error C2665: 'boost::hash_value' : none of the 16 overloads could
> convert all the argument types
>
> 1> c:\program files\boost\boost/functional/hash/hash.hpp(33): could be
> 'size_t boost::hash_value(bool)'
>
> 1> c:\program files\boost\boost/functional/hash/hash.hpp(34): or 'size_t
> boost::hash_value(char)'
>
> 1> c:\program files\boost\boost/functional/hash/hash.hpp(35): or 'size_t
> boost::hash_value(unsigned char)'
>
> 1> c:\program files\boost\boost/functional/hash/hash.hpp(36): or 'size_t
> boost::hash_value(signed char)'
>
> 1> c:\program files\boost\boost/functional/hash/hash.hpp(37): or 'size_t
> boost::hash_value(short)'
>
> 1> c:\program files\boost\boost/functional/hash/hash.hpp(38): or 'size_t
> boost::hash_value(unsigned short)'
>
> 1> c:\program files\boost\boost/functional/hash/hash.hpp(39): or 'size_t
> boost::hash_value(int)'
>
> 1> c:\program files\boost\boost/functional/hash/hash.hpp(40): or 'size_t
> boost::hash_value(unsigned int)'
>
> 1> c:\program files\boost\boost/functional/hash/hash.hpp(41): or 'size_t
> boost::hash_value(long)'
>
> 1> c:\program files\boost\boost/functional/hash/hash.hpp(42): or 'size_t
> boost::hash_value(unsigned long)'
>
> 1> c:\program files\boost\boost/functional/hash/hash.hpp(45): or 'size_t
> boost::hash_value(wchar_t)'
>
> 1> c:\program files\boost\boost/functional/hash/hash.hpp(49): or 'size_t
> boost::hash_value(boost::long_long_type)'
>
> 1> c:\program files\boost\boost/functional/hash/hash.hpp(50): or 'size_t
> boost::hash_value(boost::ulong_long_type)'
>
> 1> c:\program files\boost\boost/functional/hash/hash.hpp(67): or 'size_t
> boost::hash_value(float)'
>
> 1> c:\program files\boost\boost/functional/hash/hash.hpp(68): or 'size_t
> boost::hash_value(double)'
>
> 1> c:\program files\boost\boost/functional/hash/hash.hpp(69): or 'size_t
> boost::hash_value(long double)'
>
> 1> while trying to match the argument list '(const
> boost::tokenizer<TokenizerFunc>)'
>
> 1> with
>
> 1> [
>
> 1> TokenizerFunc=boost::char_separator<char>
>
> 1> ]
>
> 1> c:\program files\boost\boost/functional/hash/extensions.hpp(71) :
> while compiling class template member function 'size_t
> boost::hash<T>::operator ()(const T &) const'
>
> 1> with
>
> 1> [
>
> 1> T=boost::tokenizer<boost::char_separator<char>>
>
> 1> ]
>
> 1> c:\program files\boost\boost/concept_check.hpp(334) : see reference
> to class template instantiation 'boost::hash<T>' being compiled
>
> 1> with
>
> 1> [
>
> 1> T=boost::tokenizer<boost::char_separator<char>>
>
> 1> ]
>
> 1> c:\program files\boost\boost/concept_check.hpp(317) : see reference
> to class template instantiation 'boost::UnaryFunction<Func,Return,Arg>'
> being compiled
>
> 1> with
>
> 1> [
>
> 1> Func=boost::hash<boost::tokenizer<boost::char_separator<char>>>,
>
> 1> Return=size_t,
>
> 1> Arg=boost::tokenizer<boost::char_separator<char>>
>
> 1> ]
>
> 1> c:\program files\boost\boost/concept/detail/has_constraints.hpp(40) :
> see reference to class template instantiation
> 'boost::UnaryFunctionConcept<Func,Return,Arg>' being compiled
>
> 1> with
>
> 1> [
>
> 1> Func=boost::hash<boost::tokenizer<boost::char_separator<char>>>,
>
> 1> Return=size_t,
>
> 1> Arg=boost::tokenizer<boost::char_separator<char>>
>
> 1> ]
>
> 1> c:\program files\boost\boost/concept/detail/msvc.hpp(52) : see
> reference to class template instantiation
> 'boost::concept::not_satisfied<Model>' being compiled
>
> 1> with
>
> 1> [
>
> 1>
> Model=boost::UnaryFunctionConcept<boost::hash<boost::tokenizer<boost::ch
> ar_separator<char>>>,size_t,boost::tokenizer<boost::char_separator<char>
>
> 1> ]
>
> 1> c:\program files\boost\boost/bimap/unordered_set_of.hpp(142) : see
> reference to class template instantiation
> 'boost::concept::require<Model>' being compiled
>
> 1> with
>
> 1> [
>
> 1>
> Model=boost::UnaryFunctionConcept<boost::hash<boost::tokenizer<boost::ch
> ar_separator<char>>>,size_t,boost::tokenizer<boost::char_separator<char>
>
> 1> ]
>
> 1> c:\program files\boost\boost/bimap/detail/manage_bimap_key.hpp(69) :
> see reference to class template instantiation
> 'boost::bimaps::unordered_set_of<KeyType>::lazy_concept_checked' being
> compiled
>
> 1> with
>
> 1> [
>
> 1> KeyType=boost::tokenizer<boost::char_separator<char>>
>
> 1> ]
>
> 1> c:\program files\boost\boost/bimap/detail/bimap_core.hpp(90) : see
> reference to class template instantiation
> 'boost::bimaps::detail::manage_bimap_key<Type>' being compiled
>
> 1> with
>
> 1> [
>
> 1>
> Type=boost::bimaps::unordered_set_of<boost::tokenizer<boost::char_separa
> tor<char>>>
>
> 1> ]
>
> 1> c:\program files\boost\boost/bimap/bimap.hpp(137) : see reference to
> class template instantiation
> 'boost::bimaps::detail::bimap_core<LeftSetType,RightSetType,AP1,AP2,AP3>
> ' being compiled
>
> 1> with
>
> 1> [
>
> 1>
> LeftSetType=boost::bimaps::unordered_set_of<boost::tokenizer<boost::char
> _separator<char>>>,
>
> 1> RightSetType=std::string,
>
> 1> AP1=boost::mpl::na,
>
> 1> AP2=boost::mpl::na,
>
> 1> AP3=boost::mpl::na
>
> 1> ]
>
> 1> .\VDux.cpp(51) : see reference to class template instantiation
> 'boost::bimaps::bimap<KeyTypeA,KeyTypeB>' being compiled
>
> 1> with
>
> 1> [
>
> 1>
> KeyTypeA=boost::bimaps::unordered_set_of<boost::tokenizer<boost::char_se
> parator<char>>>,
You are trying to use unordered_set with key (tokenizer<>) for which
there is no hashing functor defined. You will have to supply some. And
then even if you manage to create one, is there any meaningful
operator==? You should probably just store pointers to tokenize<> in the
bimap instead.

>
> 1> KeyTypeB=std::string
>
> 1> ]
>
> 1>Build log was saved at "file://f:\hd\work\Freedom Of
> Speech\V-Ware\V-Dux\Dll\Release\BuildLog.htm"
>
> 1>VDux - 1 error(s), 0 warning(s)
>
> ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
> ==========
>
> using visual studio 2008.
>
> Anyone give me any pointers.
>
> Cheers
>
> Sean.
>

--
VH

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net