88 lines
2.1 KiB
C++
88 lines
2.1 KiB
C++
/* Check cf5-opt.vim defs.
|
|
VIM: let g:lcppflags="-std=c++11 -O2 -pthread"
|
|
VIM: let g:wcppflags="/O2 /EHsc /DWIN32"
|
|
VIM: let g:cppflags=g:Iboost.g:Itbb
|
|
VIM: let g:ldflags=g:Lboost.g:Ltbb.g:tbbmalloc.g:tbbmproxy
|
|
VIM: let g:ldlibpath=g:Bboost.g:Btbb
|
|
VIM: let g:argv=""
|
|
VIM-: let g:cf5output=0
|
|
*/
|
|
#include <iostream>
|
|
#include <exception>
|
|
|
|
#include <boost/multi_index_container.hpp>
|
|
//#include <boost/multi_index/sequenced_index.hpp>
|
|
#include <boost/multi_index/hashed_index.hpp>
|
|
#include <boost/multi_index/ordered_index.hpp>
|
|
#include <boost/multi_index/member.hpp>
|
|
#include <boost/multi_index/identity.hpp>
|
|
|
|
struct entry
|
|
{
|
|
std::string d_sessionId;
|
|
std::string d_curveId;
|
|
std::string key3;
|
|
};
|
|
|
|
typedef boost::multi_index::ordered_unique<
|
|
boost::multi_index::identity<entry>
|
|
> index_by_entry;
|
|
|
|
struct ByCurveId {};
|
|
typedef boost::multi_index::hashed_unique<
|
|
boost::multi_index::tag<ByCurveId>,
|
|
boost::multi_index::member<
|
|
entry,
|
|
std::string,
|
|
&entry::d_curveId
|
|
>
|
|
> index_ByCurveId;
|
|
|
|
struct BySessionId {};
|
|
typedef boost::multi_index::hashed_unique<
|
|
boost::multi_index::tag<BySessionId>,
|
|
boost::multi_index::member<
|
|
entry,
|
|
std::string,
|
|
&entry::d_sessionId
|
|
>
|
|
> index_BySessionId;
|
|
|
|
typedef boost::multi_index_container<
|
|
entry,
|
|
boost::multi_index::indexed_by<
|
|
//boost::multi_index::sequenced<>,
|
|
//index_by_entry,
|
|
index_BySessionId,
|
|
index_ByCurveId
|
|
>
|
|
> my_multi_index_container_type;
|
|
|
|
int main ( void )
|
|
{try{
|
|
|
|
my_multi_index_container_type c;
|
|
|
|
if ( c.get<BySessionId>().find( "tutuc" )
|
|
== c.get<BySessionId>().end() )
|
|
{
|
|
std::cout << "no tutuc\n";
|
|
}
|
|
|
|
|
|
return 0;
|
|
}
|
|
catch ( const std::exception& e )
|
|
{
|
|
std::cerr << std::endl
|
|
<< "std::exception(\"" << e.what() << "\")." << std::endl;
|
|
return 2;
|
|
}
|
|
catch ( ... )
|
|
{
|
|
std::cerr << std::endl
|
|
<< "unknown exception." << std::endl;
|
|
return 1;
|
|
}}
|
|
|