A
aiooua
hello,
I had a doubt regarding the handling of enums in std::map.
Consider the following piece of code:
------
#include<iostream>
#include<map>
using namespace std;
typedef enum {
UNINITIALIZED,
MEANINGFUL_1,
MEANINGFUL_2
}code;
typedef enum {
O_UNINITIALIZED = 100,
O_MEANINGFUL_1,
O_MEANINGFUL_2
}another_code;
int main(){
map<string,code> codetta;
map<string,another_code> coda;
cout<<codetta["unset"]<<endl;
cout<<coda["unset"]<<endl;
}
------
Is it ok to assume that for both maps, the data-value returned for all
unset key-values will -always- be 0?
thanks for your time,
I had a doubt regarding the handling of enums in std::map.
Consider the following piece of code:
------
#include<iostream>
#include<map>
using namespace std;
typedef enum {
UNINITIALIZED,
MEANINGFUL_1,
MEANINGFUL_2
}code;
typedef enum {
O_UNINITIALIZED = 100,
O_MEANINGFUL_1,
O_MEANINGFUL_2
}another_code;
int main(){
map<string,code> codetta;
map<string,another_code> coda;
cout<<codetta["unset"]<<endl;
cout<<coda["unset"]<<endl;
}
------
Is it ok to assume that for both maps, the data-value returned for all
unset key-values will -always- be 0?
thanks for your time,