名前の長さに関するこの警告は常に無害ですか? そうでない場合、問題があるかどうかをどうやって知ることができますか?
C++ の型管理で素晴らしい点の 1 つは、名前の長さを超えた場合です。 リンクされた質問は、それをオフにする方法を示しています。Boost 1.53 で Visual C++ 2008 を使用しています。
ただし、このテンプレート化された typedef 型名の制限に達したのはこれが初めてであり、Visual C++ 2008 を使用しているため、間違いや回避できることをしていないことを確認したいと思います。
これが私のtypedefです:
// 値型の std::pair の後半は構造体です:
typedef struct _DATA_AREA_DESC
{
// stuff in here doesn't matter, omitted.
} AreaMappedType;
// マップのキーは文字列です。タイプとそのアロケーターを定義する必要があります。std::string は、このコンパイラ + 標準ライブラリの実装には適していません (VC++2008)
typedef boost::interprocess::allocator<char, boost::interprocess::managed_shared_memory::segment_manager> CharAllocator;
typedef boost::interprocess::basic_string<char, std::char_traits<char>, CharAllocator> AreaKeyType;
// AreaMap is a map<AreaKeyType,AreaMappedType>
typedef std::pair<const AreaKeyType, AreaMappedType> AreaValueType;
typedef boost::interprocess::allocator<AreaValueType, boost::interprocess::managed_shared_memory::segment_manager> AreaShmemAllocator;
typedef boost::interprocess::map<AreaKeyType, AreaMappedType, std::less<AreaKeyType>, AreaShmemAllocator> AreaMap;
うんざりするほど長くて読めない警告の詳細テキストのスニペット:
1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\utility(48) : warning C4503: 'std::pair<_Ty1,_Ty2>::pair' : decorated name length exceeded, name was truncated
1> with
1> [
1> _Ty1=boost::intrusive::tree_iterator<boost::intrusive::rbtree_impl<boost::intrusive::setopt<boost::intrusive::detail::base_hook_traits<boost::container::container_detail::rbtree_node<std::pair<const AreaKeyType,AreaMappedType>,boost::interprocess::offset_ptr<void>>,boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>,true>,normal_link,boost::intrusive::default_tag,3>,boost::container::container_detail::node_compare<boost::container::container_detail::tree_value_compare<AreaKeyType,std::pair<const AreaKeyType,AreaMappedType>,std::less<AreaKeyType>,boost::container::container_detail::select1st<std::pair<const AreaKeyType,AreaMappedType>>>,boost::container::container_detail::rbtree_node<std::pair<const AreaKeyType,AreaMappedType>,boost::interprocess::offset_ptr<void>>>,unsigned int,true>>,false>,
1> _Ty2=bool
1> ]
1> c:\dev\boost\boost_1_53_0\boost\container\detail\tree.hpp(750) : see reference to class template instantiation 'std::pair<_Ty1,_Ty2>' being compiled
1> with
1> [
1> _Ty1=boost::intrusive::tree_iterator<boost::intrusive::rbtree_impl<boost::intrusive::setopt<boost::intrusive::detail::base_hook_traits<boost::container::container_detail::rbtree_node<std::pair<const AreaKeyType,AreaMappedType>,boost::interprocess::offset_ptr<void>>,boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>,true>,normal_link,boost::intrusive::default_tag,3>,boost::container::container_detail::node_compare<boost::container::container_detail::tree_value_compare<AreaKeyType,std::pair<const AreaKeyType,AreaMappedType>,std::less<AreaKeyType>,boost::container::container_detail::select1st<std::pair<const AreaKeyType,AreaMappedType>>>,boost::container::container_detail::rbtree_node<std::pair<const AreaKeyType,AreaMappedType>,boost::interprocess::offset_ptr<void>>>,unsigned int,true>>,false>,
1> _Ty2=bool
1> ]
1> c:\dev\boost\boost_1_53_0\boost\container\detail\tree.hpp(749) : while compiling class template member function 'std::pair<_Ty1,_Ty2> boost::container::container_detail::rbtree<Key,Value,KeyOfValue,KeyCompare,A>::insert_unique_check(const boost::container::basic_string<CharT,Traits,Allocator> &,boost::intrusive::detail::tree_algorithms<NodeTraits>::insert_commit_data &)'
1> with
1> [
1> _Ty1=boost::container::container_detail::rbtree<AreaKeyType,std::pair<const AreaKeyType,AreaMappedType>,boost::container::container_detail::select1st<std::pair<const AreaKeyType,AreaMappedType>>,std::less<AreaKeyType>,AreaShmemAllocator>::iterator,
1> _Ty2=bool,
1> Key=AreaKeyType,
1> Value=std::pair<const AreaKeyType,AreaMappedType>,
1> KeyOfValue=boost::container::container_detail::select1st<std::pair<const AreaKeyType,AreaMappedType>>,
1> KeyCompare=std::less<AreaKeyType>,
1> A=AreaShmemAllocator,
1> CharT=char,
1> Traits=std::char_traits<char>,
1> Allocator=CharAllocator,
1> NodeTraits=boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>,true>
1> ]
1> c:\dev\boost\boost_1_53_0\boost\container\map.hpp(82) : see reference to class template instantiation 'boost::container::container_detail::rbtree<Key,Value,KeyOfValue,KeyCompare,A>' being compiled
1> with
1> [
1> Key=AreaKeyType,
1> Value=std::pair<const AreaKeyType,AreaMappedType>,
1> KeyOfValue=boost::container::container_detail::select1st<std::pair<const AreaKeyType,AreaMappedType>>,
1> KeyCompare=std::less<AreaKeyType>,
1> A=AreaShmemAllocator
1> ]
1> c:\dev\boost\boost_1_53_0\boost\type_traits\is_abstract.hpp(72) : see reference to class template instantiation 'boost::container::map<Key,T,Compare,Allocator>' being compiled
1> with
1> [
1> Key=AreaKeyType,
1> T=AreaMappedType,
1> Compare=std::less<AreaKeyType>,
1> Allocator=AreaShmemAllocator
1> ]
1> c:\dev\boost\boost_1_53_0\boost\type_traits\is_abstract.hpp(144) : see reference to class template instantiation 'boost::detail::is_abstract_imp<T>' being compiled
1> with
1> [
1> T=AreaMap
1> ]
1> c:\dev\boost\boost_1_53_0\boost\mpl\aux_\preprocessed\plain\or.hpp(51) : see reference to class template instantiation 'boost::is_abstract<T>' being compiled
1> with
1> [
1> T=AreaMap
1> ]
1> c:\dev\boost\boost_1_53_0\boost\mpl\if.hpp(63) : see reference to class template instantiation 'boost::mpl::or_<T1,T2>' being compiled
1> with
1> [
1> T1=boost::is_abstract<AreaMap>,
1> T2=boost::is_array<AreaMap>
1> ]
1> c:\dev\boost\boost_1_53_0\boost\foreach.hpp(489) : see reference to class template instantiation 'boost::mpl::if_<T1,T2,T3>' being compiled
1> with
1> [
1> T1=boost::mpl::or_<boost::is_abstract<AreaMap>,boost::is_array<AreaMap>>,
1> T2=boost::foreach_detail_::rvalue_probe<AreaMap>::private_type_,
1> T3=AreaMap
1> ]
1> c:\dev\dnp3_driver_2008r2\osdk\libraries\memory20\ed3drvmemory.cpp(229) : see reference to class template instantiation 'boost::foreach_detail_::rvalue_probe<T>' being compiled
1> with
1> [
1> T=AreaMap
1> ]
1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\utility(48) : warning C4503: 'std::pair<_Ty1,_Ty2>::pair' : decorated name length exceeded, name was truncated
1> with
1> [
1>
これは修正できますか?私は初歩的なミスを犯しましたか?