Bimap Reference - 1.68.0 - Boost C++ Libraries
文章推薦指數: 80 %
Views are not isolated objects and so cannot be constructed on their own; rather they are an integral part of a bimap . The name of the view class ...
Boost
C++Libraries
...oneofthemosthighly
regardedandexpertlydesignedC++libraryprojectsinthe
world.—HerbSutterandAndrei
Alexandrescu,C++
CodingStandards
ThisisthedocumentationforanoldversionofBoost.
Clickheretoviewthispageforthelatestversion.
BimapReference
View
concepts
Complexity
signature
Set
typespecification
Tags
Header
"boost/bimap/bimap.hpp"synopsis
Class
templatebimap
Complexity
Instantiation
types
Nested
types
Constructors,
copyandassignment
Projection
operations
Support
foruserdefinednames
Serialization
View
concepts
bimapinstantiationscomprise
twosideviewsandanviewoftherelationspecifiedatcompiletime.Each
viewallowsread-writeaccesstotheelementscontainedinadefinitemanner,
mathinganSTLcontainersignature.
Viewsarenotisolatedobjectsandsocannotbeconstructedontheirown;
rathertheyareanintegralpartofabimap.
Thenameoftheviewclassimplementationproperisneverdirectlyexposed
totheuser,whohasaccessonlytotheassociatedviewtypespecifier.
Insertionanddeletionofelementsarealwaysperformedthroughtheappropriate
interfaceofanyofthethreeviewsofthebimap;
theseoperationsdo,however,haveanimpactonallotherviewsaswell:
forinstance,insertionthroughagivenviewmayfailbecausethereexists
anotherviewthatforbidstheoperationinordertopreserveitsinvariant
(suchasuniquenessofelements).Theglobaloperationsperformedjointly
intheanyviewcanbereducedtosixprimitives:
copying
insertionofanelement
hintedinsertion,whereapre-existingelementissuggestedinorder
toimprovetheefficiencyoftheoperation
deletionofanelement
replacementofthevalueofanelement,whichmaytriggertherearrangement
ofthiselementinoneormoreviews,ormayforbidthereplacement
modificationofanelement,anditssubsequentrearrangement/banning
bythevariousviews
Thelasttwoprimitivesdeservesomefurtherexplanation:inordertoguarantee
theinvariantsassociatedtoeachview(e.g.somedefiniteordering)elements
ofabimaparenotmutable.
Toovercomethisrestriction,theviewsexposememberfunctionsforupdating
andmodifying,whichallowsforthemutationofelementsinacontrolled
fashion.
Complexity
signature
Somememberfunctionsofaviewinterfaceareimplementedbyglobalprimitives
fromtheabovelist.Thecomplexityoftheseoperationsthusdependson
allviewsofagivenbimap,
notjustthecurrentlyusedview.
Inordertoestablishcomplexityestimates,aviewischaracterisedby
itscomplexitysignature,consistingofthefollowingassociatedfunctions
onthenumberofelements:
c(n):
copying
i(n):
insertion
h(n):
hintedinsertion
d(n):
deletion
r(n):
replacement
m(n):
modifying
Ifthecollectiontypeoftherelationisleft_based
orright_based,andwe
useanlsubscripttodenote
theleftviewandanr
fortherightview,thentheinsertionofanelementinsuchacontainer
isofcomplexityO(i_l(n)+i_r(n)),
wherenisthenumberofelements.Ifthecollectiontypeofrelationis
notside-based,thenthereisanadditionaltermtoaddthatiscontributed
bythecollectiontypeofrelationview.Usinga
todenotetheaboveview,thecomplexityofinsertionwillnowbeO(i_l(n)+i_r(n)+i_a(n)).
Toabbreviatethenotation,weadoptthefollowingdefinitions:
C(n)=c_l(n)+c_r(n)[+c_a(n)]
I(n)=i_l(n)+i_r(n)[+i_a(n)]
H(n)=h_l(n)+h_r(n)[+h_a(n)]
D(n)=d_l(n)+d_r(n)[+d_a(n)]
R(n)=r_l(n)+r_r(n)[+r_a(n)]
M(n)=m_l(n)+m_r(n)[+m_a(n)]
Set
typespecification
Settypespecifiersarepassedasinstantiationargumentstobimapandprovidetheinformationneeded
toincorporatethecorrespondingviews.Currently,Boost.Bimapprovides
thecollectiontypespecifiers.Thesidecollectiontype
specifiersdefinetheconstraintsofthetwomapviewsofthebimap.The
collectiontypeofrelationspecifierdefinesthe
mainsetviewconstraints.Ifleft_based
(thedefaultparameter)orright_based
isused,thenthecollectiontypeofrelationwillbebasedontheleft
orrightcollectiontypecorrespondingly.
Sidecollectiontype
Collectiontypeofrelation
Include
set_of
set_of_relation
boost/bimap/set_of.hpp
multiset_of
multiset_of_relation
boost/bimap/multiset_of.hpp
unordered_set_of
unordered_set_of_relation
boost/bimap/unordered_set_of.hpp
unordered_multiset_of
unordered_multiset_of_relation
boost/bimap/unordered_multiset_of.hpp
list_of
list_of_relation
boost/bimap/list_of.hpp
vector_of
vector_of_relation
boost/bimap/vector_of.hpp
unconstrained_set_of
unconstrained_set_of_relation
boost/bimap/unconstrained_set_of.hpp
left_based
boost/bimap/bimap.hpp
right_based
boost/bimap/bimap.hpp
Tags
Tagsarejustconventionaltypesusedasmnemonicsforthetypesstored
inabimap.Boost.Bimap
usesthetaggedidiomtolettheuserspecifythistags.
Header
"boost/bimap/bimap.hpp"synopsis
namespaceboost{
namespacebimaps{
template
延伸文章資訊
- 1BiMAP-集先鋒| ELK企業級解決方案| 大數據整合專家
- 2Bimap Reference - 1.68.0 - Boost C++ Libraries
Views are not isolated objects and so cannot be constructed on their own; rather they are an inte...
- 3【Guava 教學】(7)Multiset、Multimap 與BiMap
【Guava 教學】(7)Multiset、Multimap 與BiMap. 如果有個清單,想要取得清單中不重複的元素,最快的方式就是使用JDK 中的 Set 。例如:
- 4Guide to Google's Guava BiMap - Baeldung
A BiMap (or “bidirectional map”) is a special kind of a map that maintains an inverse view of the...
- 5BIMAP
The Barbados Institute of Management and Productivity (BIMAP) was established as a non-profit org...