Esempio n. 1
0
void test6(MyContainer& container)
{
    MyTest *a = new MyTest(2,3,1,770,7000);
    container.insert(a);
    MyTest *b = new MyTest(2,3,2,880,8000);
    container.insert(b);
    MyTest *c = new MyTest(2,3,3,990,9000);
    container.insert(c);
}
Esempio n. 2
0
void test4(MyContainer& container)
{
    MyTest *a = new MyTest(2,1,1,110,1000);
    container.insert(a);
    MyTest *b = new MyTest(2,1,2,220,2000);
    container.insert(b);
    MyTest *c = new MyTest(2,1,3,330,3000);
    container.insert(c);
}
Esempio n. 3
0
void test5(MyContainer& container)
{
    MyTest *a = new MyTest(2,2,1,440,4000);
    container.insert(a);
    MyTest *b = new MyTest(2,2,2,550,5000);
    container.insert(b);
    MyTest *c = new MyTest(2,2,3,660,6000);
    container.insert(c);
}
Esempio n. 4
0
File: main.cpp Progetto: CCJY/coliru
int main()
{
    MyContainer c;

    MyContainer::index<Tag1>::type& index1 = c.get<Tag1>();
    MyContainer::index<Tag2>::type& index2 = c.get<Tag2>();

    //! Add some values
    for (int i = 0; i < 10; ++i) {
        MyStruct s = { i, i * 2, i * 3 };
        c.insert(s);
    }

    auto loop = [](const MyStruct& s){ std::cout << "{ " << s.a << ", " << s.b << ", " << s.c << " }" << std::endl; };

    // Search in container
    bool useIndex1 = true;
    if (useIndex1) {
        auto range = std::make_pair(index1.begin(), index1.end());
        std::for_each(range.first, range.second, loop);
    } else {
        auto range = std::make_pair(index1.begin(), index1.end());
        std::for_each(range.first, range.second, loop);
    }

    // Loop through range
    //for (auto i = range.first; i != range.second; ++i)
    //  ;
    
    IndexedFileInfo c1;
    std::vector<MLLEntry::LoadableFilePair> fileInfo_03_08_12_23 = {
        MLLEntry::LoadableFilePair("004.txt", "004.txt"),
        MLLEntry::LoadableFilePair("005.txt", "005.txt"),
        MLLEntry::LoadableFilePair("005.txt", "005.txt"),
    };

    // emplace construct MLLEntries
    for (const auto& next : fileInfo_03_08_12_23) {
        c1.emplace(MLLEntry::HRQuartet(3, 8, 12, 23), next);
    }

    IndexedFileInfo c2(std::move(c1));
    IndexedFileInfo::index<composite>::type& index3 = c2.get<composite>();
    IndexedFileInfo::index<dirfilter>::type& index4 = c1.get<composite>();     

    auto range = std::make_pair(index3.begin(), index3.end());
    std::copy(range.first, range.second,
        std::ostream_iterator<MLLEntry>(std::cout, "\n"));

    auto range1 = std::make_pair(index4.begin(), index4.end());
    std::copy(range1.first, range1.second,
        std::ostream_iterator<MLLEntry>(std::cout, "\n"));

    return 0;
}