I dont understand how It's working, I have a map wchis is composed by several things...but the definitions that I find on map aren't appropiate to what I have...My map and the things that compose it are the followings...
1 2
template<const usint ne,const usint ns>;being usint unsignedshortint
map<ulint,square<ne,ns>; ulint is a unsignedlongint
square is a struct like this
1 2 3
struct square{
FourTerms<ne> x;
TwoTerms<ns> y;
being FourTerms<ne> and TwoTerms<ns> this...
1 2 3
using FourTerms = array<boolean_l4v,ne>;
using TwoTerms = array<bool,ns>;
being boolean_l4v a type with his own methods to work...
My quiestion is , when I have declared map, I think that I should declared more parameters in the template to work qith that properly...I mean it uses a compare and an allocator...I dont know if the use them implicitely or not...Thanks!!
Map requires allocator and comparator. It provides default, and if you are not providing them and it compiles, then it must mean that default version are used implicitely, right?
I have debugged my program I have seen that It's using compare less( according to the description is the one it uses as default, and allocator is using this ...
allocator::<std:pair<unsigned long const,square<4u,2u>...
I see that the allocator is choosen according to the type which composes the map( i dont see the logic yet...), but my map is composed by an struct square....I dont know if I have lost a step finding out the type of my container or if allocator interprets struct square as a pair.....in fact that struct has two data member...
no the cube has two data members which at the same time they are two template arrays with two differents types...each types has they own method..yes, one template argument, but as I said they are composed by arrays templates...
I want to know the operation of a big program, and I should need how the map is made...
I'll have a look on that and I'll say to you if I got it...
I meant one template refering to the square...which at the same time is a template with two nontype parameter...
Map alwasys has 4 parameters, but in my case two are the default ones...and I know why allocator is like it's...
Allocator defines two parameter by default..one is the key, and it gets the type that you have passed to the map as the seocnd parameter too...so It's logic std::allocator<T,square<ne,ns>>
but apart from that I have read in the stl map library this...
For a @c map<Key,T> the key_type is Key, the mapped_type is T, and the
* value_type is std::pair<const Key,T>.
where is allocator??.....it's the value_type?? It has the same parameter that I saw debbuging...
std::allocator takes one template parameter. so it cannot have two as described. In the AllocatorAwareContainer requirement it is said that allocator::value_type should be same as container::value_type. As value_type for std::map is std::pair<const Key, Value>, it is the default parameter for std::allocator too.
yes, that's true, I got a confuising because It was a pair I said that like it was two parameter, It's just one parameter but It's a pair which is composed by two parameter....is that correct??,heheehe
However actual parameter to map allocator is irrelevant as map does not use that allocator to actually alocate memory. It uses it to get another allocator for some internal node type which would actually be used.