}
}
template<class T>
+inline void encode(const std::list<ceph::shared_ptr<T> >& ls, bufferlist& bl, uint64_t features)
+{
+ // should i pre- or post- count?
+ if (!ls.empty()) {
+ unsigned pos = bl.length();
+ unsigned n = 0;
+ encode(n, bl);
+ for (typename std::list<ceph::shared_ptr<T> >::const_iterator p = ls.begin(); p != ls.end(); ++p) {
+ n++;
+ encode(**p, bl, features);
+ }
+ ceph_le32 en;
+ en = n;
+ bl.copy_in(pos, sizeof(en), (char*)&en);
+ } else {
+ __u32 n = (__u32)(ls.size()); // FIXME: this is slow on a list.
+ encode(n, bl);
+ for (typename std::list<ceph::shared_ptr<T> >::const_iterator p = ls.begin(); p != ls.end(); ++p)
+ encode(**p, bl, features);
+ }
+}
+template<class T>
inline void decode(std::list<ceph::shared_ptr<T> >& ls, bufferlist::iterator& p)
{
__u32 n;