cprover
abstract_object_set.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3  Module: analyses variable-sensitivity
4 
5  Author: Jez Higgins, jez@jezuk.co.uk
6 
7 \*******************************************************************/
8 
10 #include <util/string_utils.h>
11 
12 static bool by_length(const std::string &lhs, const std::string &rhs)
13 {
14  if(lhs.size() < rhs.size())
15  return true;
16  if(lhs.size() > rhs.size())
17  return false;
18  return lhs < rhs;
19 }
20 
22  std::ostream &out,
23  const ai_baset &ai,
24  const namespacet &ns) const
25 {
26  std::vector<std::string> output_values;
27  for(const auto &value : values)
28  {
29  std::ostringstream ss;
30  value->output(ss, ai, ns);
31  output_values.emplace_back(ss.str());
32  }
33  std::sort(output_values.begin(), output_values.end(), by_length);
34 
35  join_strings(out, output_values.begin(), output_values.end(), ", ");
36 }
static bool by_length(const std::string &lhs, const std::string &rhs)
an unordered set of value objects
void output(std::ostream &out, const ai_baset &ai, const namespacet &ns) const
This is the basic interface of the abstract interpreter with default implementations of the core func...
Definition: ai.h:120
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:92
Stream & join_strings(Stream &&os, const It b, const It e, const Delimiter &delimiter, TransformFunc &&transform_func)
Prints items to an stream, separated by a constant delimiter.
Definition: string_utils.h:62