I am trying to make multiple index container using type hiding for indexed_by part. So i start by making the type to be used in container and make some tags
struct Log_file_Dur_Sig_F_Map_struct //Duration_Signal_Folder_Map_struct >>>log file destination
{
int Id;
std::string Duration;
std::string FolderDuration;
std::string FolderDurationSpecefied;
std::string FolderDurationPathString;
std::string FolderDurationSpecefiedPathString;
Log_file_Dur_Sig_F_Map_struct(const std::string& duration, const std::string& folderdurationspecefied, std::string const& folderdurationspecefiedpathstring ) : Duration(duration), FolderDurationSpecefied(folderdurationspecefied), FolderDurationSpecefiedPathString(folderdurationspecefiedpathstring)
{
if (duration == "AllTime")
{
Id = 0;
}
else if (duration == "Yearly")
{
Id = 1;
}
else if (duration == "Monthly")
{
Id = 2;
}
else if (duration == "Daily")
{
Id = 3;
}
/*
switch (duration)
{
case "AllTime": printf("Choice is AllTime");
break;
case "Yearly": printf("Choice is 2");
break;
case "Monthly": printf("Choice is 3");
break;
case "Daily": printf("Choice is 3");
break;
default: printf("Choice other than 1, 2 and 3");
break;
}
*/
}
bool operator<(const Log_file_Dur_Sig_F_Map_struct& e)const { return Id<e.Id; }
};
/* tags for accessing the corresponding indices of Log_file_Dur_Sig_F_Map_struct_set */
struct Id {};
struct Duration_d {};
struct FolderDuration {};
struct FolderDurationSpecefied {};
/*
struct FolderDurationPathString {};
struct FolderDurationSpecefiedPathString {};
struct Duration_FolderDuration {};
struct FolderDuration_FolderDurationSpecefied {};
struct FolderDurationSpecefiedPathString {};
struct FolderDurationSpecefiedPathString {};
struct FolderDurationSpecefiedPathString {};
*/
struct D_FD_FDS {};
/*
*NB: The use of derivation here instead of simple typedef is explained in
* Compiler specifics : type hiding.
*/
struct D_FD_FDS_key :composite_key <
Log_file_Dur_Sig_F_Map_struct,
BOOST_MULTI_INDEX_MEMBER(Log_file_Dur_Sig_F_Map_struct, std::string, Duration),
BOOST_MULTI_INDEX_MEMBER(Log_file_Dur_Sig_F_Map_struct, std::string, FolderDuration),
BOOST_MULTI_INDEX_MEMBER(Log_file_Dur_Sig_F_Map_struct, std::string, FolderDurationSpecefied)
> {};
struct Log_file_Dur_Sig_F_Map_struct_set_indices :
indexed_by <
ordered_unique<
//tag<Id>, BOOST_MULTI_INDEX_MEMBER(Log_file_Dur_Sig_F_Map_struct, int, Id)>,
tag<Id>, member<Log_file_Dur_Sig_F_Map_struct, int, &Log_file_Dur_Sig_F_Map_struct::Id> >,
ordered_non_unique<
tag<Duration_d>, BOOST_MULTI_INDEX_MEMBER(Log_file_Dur_Sig_F_Map_struct, std::string, Duration)>,
ordered_non_unique<
tag<FolderDuration>, BOOST_MULTI_INDEX_MEMBER(Log_file_Dur_Sig_F_Map_struct, std::string, FolderDuration)>,
ordered_non_unique<
tag<FolderDurationSpecefied>, BOOST_MULTI_INDEX_MEMBER(Log_file_Dur_Sig_F_Map_struct, std::string, FolderDurationSpecefied)>,
ordered_unique<
tag<D_FD_FDS>, D_FD_FDS_key >
>
{};
typedef multi_index_container<
Log_file_Dur_Sig_F_Map_struct,
Log_file_Dur_Sig_F_Map_struct_set_indices
> Log_file_Dur_Sig_F_Map_struct_set;
Then i make typedef for one index of this container
typedef Log_file_Dur_Sig_F_Map_struct_set::index<D_FD_FDS>::type Log_file_Dur_Sig_F_Map_struct_set_by_D_FD_FDS;
but when i try to use Log_file_Dur_Sig_F_Map_struct_set_by_D_FD_FDS
to get iterator ,intellisense of visual studio tells me that the type of this index is mpl::void
i think this is related to type hiding as now the multi index typedef does not have the expanded indexed_by list..
how can i retrieve certain index from multiindex container typedefined with derived struct of indexed_by???
I don't see any problem with your code. For instance, the following works perfectly (complete sample here):
typedef Log_file_Dur_Sig_F_Map_struct_set::index<D_FD_FDS>::type Log_file_Dur_Sig_F_Map_struct_set_by_D_FD_FDS;
typedef Log_file_Dur_Sig_F_Map_struct_set_by_D_FD_FDS::iterator Log_file_Dur_Sig_F_Map_struct_set_by_D_FD_FDS_iterator;
int main()
{
Log_file_Dur_Sig_F_Map_struct_set s;
Log_file_Dur_Sig_F_Map_struct_set_by_D_FD_FDS& sd=s.get<D_FD_FDS>();
Log_file_Dur_Sig_F_Map_struct_set_by_D_FD_FDS_iterator first=sd.begin(),last=sd.end();
assert(first==last);
}
So, my guess is that Intellisense is choking due to the complexity of the types involved. This shouln't in principle prevent you from going on with compilation.