};
public:
- struct nothing {};
-
template<typename impl>
struct value
{
object. This is what plain assignment does. This just uses
this pointer, rather than translating it from another file
into this one (which requires a tracker). */
- inline value_reference (const value_type &i, const nothing &)
+ inline value_reference (const value_type &i, const subr::nothing &)
: ref (i)
{}
typename vw::value_dispatch *_m_value;
typedef typename impl::debug_info_entry::pointer die_ptr;
- template<typename value, typename arg_type = const nothing>
+ template<typename value, typename arg_type = const subr::nothing>
struct init
{
inline init (attr_value *av,
class debug_info_entry
{
+ friend class subr::create_container;
+
public:
class children_type : public std::list<debug_info_entry>
private:
inline children_type () {}
+ template<typename input, typename tracker>
+ static inline void
+ equivalence (const iterator &out,
+ const typename input::const_iterator &in, tracker &t)
+ {
+ t.equivalence (out, in);
+ }
+
template<typename input, typename tracker>
inline children_type (const input &other, tracker &t)
{
- for (typename input::const_iterator in = other.begin ();
- in != other.end ();
- ++in)
- {
- /* Don't copy-construct the entry from *in here because that
- copies it again into the list and destroys the first copy. */
- push_back (debug_info_entry ());
- iterator out = --end ();
- out->set (*in, t);
- t.equivalence (out, in);
- }
+ subr::create_container (this, other, t, equivalence<input, tracker>);
}
public:
class compile_unit : public debug_info_entry
{
+ friend class subr::create_container;
friend class compile_units;
private:
inline compile_unit () : debug_info_entry (::DW_TAG_compile_unit) {}
class compile_units : public std::list<compile_unit>
{
friend class dwarf_edit;
+ friend class subr::create_container;
private:
typedef std::list<compile_unit> _base;
template<typename input, typename tracker>
inline compile_units (const input &other, tracker &t)
{
- for (typename input::const_iterator in = other.begin ();
- in != other.end ();
- ++in)
- {
- /* Don't copy-construct the entry from *in here because that
- copies it again into the list and destroys the first copy. */
- push_back (compile_unit ());
- iterator out = --end ();
- out->set (*in, t);
- }
+ subr::create_container (this, other, t);
}
+
#if 0 // dwarf_output might use this (?)
template<typename input, typename tracker>
inline compile_units (const input &units, tracker &t)
template<typename flavor, typename input>
static inline value_dispatch *
- make (flavor *&, const input &, const dwarf_data::nothing &)
+ make (flavor *&, const input &, const subr::nothing &)
{
throw std::logic_error ("dwarf_output cannot be default-constructed");
}
{
friend class debug_info_entry;
private:
- children_type () {}
+ inline children_type () {}
template<typename input>
inline children_type (const input &other, dwarf_output_collector &c)
_m_tracker->abort ();
}
};
+
+ struct nothing
+ {
+ template<typename... args>
+ inline void operator () (args&&...) const {}
+ };
+
+ // Class instead of function so it can be a friend.
+ struct create_container
+ {
+ template<typename container, typename input, typename arg_type,
+ typename hook_type = const nothing>
+ inline create_container (container *me, const input &other,
+ arg_type &arg, hook_type &hook = hook_type ())
+ {
+ for (typename input::const_iterator in = other.begin ();
+ in != other.end ();
+ ++in)
+ {
+ /* Don't copy-construct the entry from *in here because that
+ copies it again into the list and destroys the first copy. */
+ me->push_back (typename container::value_type ());
+ typename container::iterator out = --me->end ();
+ out->set (*in, arg);
+ hook (out, in, arg);
+ }
+ }
+ };
};
};