当前位置: 首页>>代码示例>>C++>>正文


C++ KeyType::end方法代码示例

本文整理汇总了C++中KeyType::end方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyType::end方法的具体用法?C++ KeyType::end怎么用?C++ KeyType::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KeyType的用法示例。


在下文中一共展示了KeyType::end方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getAssignment

bool CexCachingSolver::getAssignment(const Query& query, Assignment *&result) {
  KeyType key;

  if (lookupAssignment(query, key, result))
    return true;

  std::vector<const Array*> objects;
  findSymbolicObjects(key.begin(), key.end(), objects);

  std::vector< std::vector<unsigned char> > values;
  bool hasSolution;
  if (!solver->impl->computeInitialValues(query, objects, values, 
                                          hasSolution))
    return false;
    
  AssignmentCacheWrapper *bindingWrapper;
  Assignment *binding;
  if (hasSolution) {
    binding = new Assignment(objects, values);

    // Memoize the result.
    std::pair<assignmentsTable_ty::iterator, bool>
      res = assignmentsTable.insert(binding);
    if (!res.second) {
      delete binding;
      binding = *res.first;
    }
    
    if (DebugCexCacheCheckBinding)
      if (!binding->satisfies(key.begin(), key.end())) {
        query.dump();
        binding->dump();
        klee_error("Generated assignment doesn't match query");
      }

    bindingWrapper = new AssignmentCacheWrapper(binding);
  } else {
    unsatCore = solver->impl->getUnsatCore();
    binding = (Assignment *) 0;
    bindingWrapper = new AssignmentCacheWrapper(unsatCore);
  }
  
  result = binding;
  cache.insert(key, bindingWrapper);

  return true;
}
开发者ID:tracer-x,项目名称:klee,代码行数:47,代码来源:CexCachingSolver.cpp

示例2: searchForAssignment

/// searchForAssignment - Look for a cached solution for a query.
///
/// \param key - The query to look up.
/// \param result [out] - The cached result, if the lookup is succesful. This is
/// either a satisfying assignment (for a satisfiable query), or 0 (for an
/// unsatisfiable query).
/// \return - True if a cached result was found.
bool CexCachingSolver::searchForAssignment(KeyType &key, Assignment *&result) {
    Assignment * const *lookup = cache.lookup(key);
    if (lookup) {
        result = *lookup;
        return true;
    }

    if (CexCacheTryAll) {
        // Look for a satisfying assignment for a superset, which is trivially an
        // assignment for any subset.
        Assignment **lookup = cache.findSuperset(key, NonNullAssignment());

        // Otherwise, look for a subset which is unsatisfiable, see below.
        if (!lookup)
            lookup = cache.findSubset(key, NullAssignment());

        // If either lookup succeeded, then we have a cached solution.
        if (lookup) {
            result = *lookup;
            return true;
        }

        // Otherwise, iterate through the set of current assignments to see if one
        // of them satisfies the query.
        for (assignmentsTable_ty::iterator it = assignmentsTable.begin(),
                ie = assignmentsTable.end(); it != ie; ++it) {
            Assignment *a = *it;
            if (a->satisfies(key.begin(), key.end())) {
                result = a;
                return true;
            }
        }
    } else {
        // FIXME: Which order? one is sure to be better.

        // Look for a satisfying assignment for a superset, which is trivially an
        // assignment for any subset.
        Assignment **lookup = cache.findSuperset(key, NonNullAssignment());

        // Otherwise, look for a subset which is unsatisfiable -- if the subset is
        // unsatisfiable then no additional constraints can produce a valid
        // assignment. While searching subsets, we also explicitly the solutions for
        // satisfiable subsets to see if they solve the current query and return
        // them if so. This is cheap and frequently succeeds.
        if (!lookup)
            lookup = cache.findSubset(key, NullOrSatisfyingAssignment(key));

        // If either lookup succeeded, then we have a cached solution.
        if (lookup) {
            result = *lookup;
            return true;
        }
    }

    return false;
}
开发者ID:xjtuSoftware,项目名称:cap_4,代码行数:63,代码来源:CexCachingSolver.cpp

示例3: getAssignment

bool CexCachingSolver::getAssignment(const Query& query, Assignment *&result) {
    KeyType key;
    if (lookupAssignment(query, key, result))
        return true;

    std::vector<const Array*> objects;
    findSymbolicObjects(key.begin(), key.end(), objects);

    std::vector< std::vector<unsigned char> > values;
    bool hasSolution;
    if (!solver->impl->computeInitialValues(query, objects, values,
                                            hasSolution))
        return false;

    Assignment *binding;
    if (hasSolution) {
        binding = new Assignment(objects, values);

        // Memoize the result.
        std::pair<assignmentsTable_ty::iterator, bool>
        res = assignmentsTable.insert(binding);
        if (!res.second) {
            delete binding;
            binding = *res.first;
        }

        if (DebugCexCacheCheckBinding)
            assert(binding->satisfies(key.begin(), key.end()));
    } else {
        binding = (Assignment*) 0;
    }

    result = binding;
    cache.insert(key, binding);

    return true;
}
开发者ID:xjtuSoftware,项目名称:cap_4,代码行数:37,代码来源:CexCachingSolver.cpp

示例4: isUniqueWithoutMissingIntegers

bool StringCipherWithPermutationKey::isUniqueWithoutMissingIntegers(const KeyType &key)
{
    const uint32_t key_len = key.size();
    const std::set<int32_t> sorted_key(key.begin(), key.end());
    if (key_len != sorted_key.size())
    {
        return false;
    }

    // Check if all integers are between 0 and the size of the key.
    const uint32_t max_int = *std::max_element(sorted_key.begin(), sorted_key.end());
    if (max_int >= key_len)
    {
        return false;
    }

    return true;
}
开发者ID:glapointe7,项目名称:CryptoGL,代码行数:18,代码来源:StringCipherWithPermutationKey.cpp


注:本文中的KeyType::end方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。