I’m confused about when to use Ada.Containers.Indefinite_Hashed_Maps or Hashed_Maps.
What is the difference between the two generic packages?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The Ada.Containers.Indefinite_Hashed_Maps package supports types that are indefinite for the key and element. An indefinite type is a type that needs an additional constraint to declare an object. Example: String, T’Class, a type with a variant part.
The Hashed_Maps implementation is able to store the key and element within the map implementation records (be it a table or a tree). This is the most efficient implementation between the two.
The Indefinite_Hashed_Maps cannot store the key and element as easily due to the additional constraint. Most implementation will have to use an access to the key and to the element
to store them. Each time an element is added, an additional memory allocation is required to store the key and element.
Although Indefinite_Hashed_Maps works for finite types, it is best to use Hashed_Maps if the key and element types are definite.