inline raw_children (const debug_info_entry &die) : _m_die (die) {}
public:
+ typedef debug_info_entry value_type;
+
inline raw_children (const raw_children &c) : _m_die (c._m_die) {}
bool empty () const
template<typename other_children>
bool operator== (const other_children &other) const
{
- return std::equal (begin (), end (), other.begin ());
+ return subr::container_equal (*this, other);
}
template<typename other_children>
bool operator!= (const other_children &other) const
raw_attributes (const debug_info_entry &die) : _m_die (die) {}
public:
+ typedef attribute value_type;
+
inline raw_attributes (const raw_attributes &a) : _m_die (a._m_die) {}
size_t size () const;
: raw_children::raw_children (die) {}
public:
+ typedef debug_info_entry value_type;
+
inline children (const children &c) : raw_children (c) {}
class const_iterator
template<typename other_children>
bool operator== (const other_children &other) const
{
- return std::equal (begin (), end (), other.begin ());
+ return subr::container_equal (*this, other);
}
template<typename other_children>
bool operator!= (const other_children &other) const
: attributes_base (raw) {}
public:
+ typedef attribute value_type;
+
inline attributes (const class attributes &a)
: attributes_base (a) {}
The directory table itself matches regardless. */
const_iterator i = begin ();
typename table::const_iterator j = other.begin ();
- return std::equal (++i, end (), ++j,
- name_equal<typename table::value_type> ());
+ return subr::container_equal
+ (++i, end (), ++j, other.end (),
+ name_equal<typename table::value_type> ());
}
public:
template<typename table>
inline bool operator== (const table &other) const
{
- return std::equal (begin (), end (), other.begin ());
+ return subr::container_equal (*this, other);
}
template<typename table>
inline bool operator!= (const table &other) const
inline bool operator== (const line_table &other) const
{
return (_m_lines == other._m_lines
- || std::equal (begin (), end (), other.begin ()));
+ || subr::container_equal (*this, other));
}
// Look up by matching address.
};
// Container for raw CUs in file order, intended to be compatible
- // with a read-only subset of std::list<raw_compile_unit>.
+ // with a read-only subset of std::list<compile_unit>.
class raw_compile_units
{
friend class dwarf;
raw_compile_units (const dwarf &file) : _m_file (file) {}
public:
+ typedef compile_unit value_type;
+
inline raw_compile_units (const raw_compile_units &u)
: _m_file (u._m_file) {}
compile_units (class raw_compile_units raw) : compile_units_base (raw) {}
public:
+ typedef compile_unit value_type;
+
compile_units (const compile_units &u) : compile_units_base (u) {}
template<typename units>
bool operator== (const units &other) const
{
- return std::equal (begin (), end (), other.begin ());
+ return subr::container_equal (*this, other);
}
template<typename units>
bool operator!= (const units &other) const
template<typename childrens>
children (const childrens &other)
: std::list<debug_info_entry> (other.begin (), other.end ()) {}
+
+ public:
+ typedef debug_info_entry value_type;
};
class attributes : public std::map<int, attr_value>
{
friend class debug_info_entry;
private:
+ typedef std::map<int, attr_value> base_type;
+
attributes () {}
template<typename attrs>
: std::map<int, attr_value> (other.begin (), other.end ()) {}
public:
+ typedef base_type::key_type key_type;
+ typedef base_type::value_type value_type;
+ typedef base_type::mapped_type mapped_type;
+
template<typename attrs>
inline operator attrs () const
{
{}
public:
+ typedef compile_unit value_type;
+
inline compile_unit &new_unit ()
{
compile_unit nu;
#define _ELFUTILS_SUBR_HH 1
#include <iterator>
+#include <functional>
namespace elfutils
{
namespace subr
{
+ template<typename t1, typename t2>
+ struct equal_to : public std::binary_function<t1, t2, bool>
+ {
+ inline bool operator () (const t1 &a, const t2 &b)
+ {
+ return a == b;
+ }
+ };
+
+ template<typename iter1, typename iter2, typename pred_type>
+ inline bool container_equal (iter1 first1, iter1 last1,
+ iter2 first2, iter2 last2,
+ pred_type pred)
+ {
+ while (first1 != last1)
+ if (first2 == last2 || !pred (*first1++, *first2++))
+ return false;
+ return first2 == last2;
+ }
+
+ template<typename t1, typename t2>
+ inline bool container_equal (const t1 &a, const t2 &b)
+ {
+ typename t1::const_iterator first1 = a.begin ();
+ typename t1::const_iterator last1 = a.end ();
+ typename t2::const_iterator first2 = b.begin ();
+ typename t2::const_iterator last2 = b.end ();
+ return container_equal (first1, last1, first2, last2,
+ equal_to<typename t1::value_type,
+ typename t2::value_type> ());
+ }
template<typename array, typename element = typename array::value_type>
class indexed_iterator