示例#1
0
StructureBuild::FixedSet
StructureBuild::getFixedSet() const
{
  FixedSet fixedSet;

  BOOST_FOREACH(AtomInfoMap::const_reference atomInfo, myAtomsInfo)
  {
    if(atomInfo.second->isFixed())
      fixedSet.insert(atomInfo.first->getIndex());
  }

  return fixedSet;
}
示例#2
0
TEST(hash_set, initialization_big) {
    FixedSet f;

    static std::default_random_engine g_random_engine;
    std::unordered_set<int> set;
    std::vector<int> keys;
    for (int i = 0; i < 10000; ++i) {
        int element = std::uniform_int_distribution<int>(-1000000000, 1000000000) (g_random_engine);
        set.insert(element);
        keys.push_back(element);
    }

    f.Init(keys);
    for (int i = -1000; i <= 1000; ++i) {
        ASSERT_TRUE((f.Contains(i)) == (set.find(i) != set.end()));
    }
}
示例#3
0
文件: c.cpp 项目: filaPro/my
void PrintAnswers(const std::vector<int> &requests, FixedSet &fixed_set, std::ostream& ostream = std::cout) {
    for (auto number : requests) {
        bool answer = fixed_set.Contains(number);
        if (answer)
            ostream << "Yes\n";
        else
            ostream << "No\n";
    } 
}
示例#4
0
TEST(hash_set, initialization) {
    FixedSet f;

    std::vector<int> keys {1, 2, 4, 5, 7, 11, 28};
    f.Init(keys);
    ASSERT_TRUE(f.Contains(11));
    ASSERT_TRUE(f.Contains(1));
    ASSERT_TRUE(f.Contains(2));
    ASSERT_FALSE(f.Contains(3));
    ASSERT_TRUE(f.Contains(4));
    ASSERT_TRUE(f.Contains(5));
    ASSERT_FALSE(f.Contains(6));
    ASSERT_TRUE(f.Contains(7));
    ASSERT_FALSE(f.Contains(8));
    ASSERT_FALSE(f.Contains(9));
    ASSERT_FALSE(f.Contains(10));
    ASSERT_FALSE(f.Contains(29));
}