[C++-sig] conversion of std::list<...> parameters in function call

Achim Domma achim.domma at syynx.de
Sun Jun 23 17:28:11 CEST 2002


> -----Original Message-----
> From: c++-sig-admin at python.org [mailto:c++-sig-admin at python.org]On
> Behalf Of Ralf W. Grosse-Kunstleve
> Subject: RE: [C++-sig] conversion of std::list<...> parameters in
> function call

> Did you have to write a new adoptor fr std::list<>? If so, could
> you please
> post it?

The following adaptor works for me with lists:

  struct growing_container_registration_adaptor
  {
    template <typename ContainerType>
    static bool check_size(boost::type<ContainerType>, std::size_t sz)
    {
      return true;
    }

    template <typename ContainerType>
    static void reserve(ContainerType& a, std::size_t sz) { }

    template <typename ContainerType, typename ValueType>
    static void set_value(ContainerType& a, std::size_t i, ValueType const&
v)
    {
      a.push_back(v);
    }
  };

Achim







More information about the Cplusplus-sig mailing list