Boost logo

Boost :

From: Gary Powell (powellg_at_[hidden])
Date: 2002-02-18 11:37:03


>>---------------------------------

"Auto" for type deduction.

template<typename T, int I>
auto foo(); // return type depends on T and I

auto bar = foo<int, 4>();

<<---------------------------------------
Yet another call for "auto" and that's for use in
teaching:

   vector<Myclass> v;

   vector<Myclass>::iterator i = v.begin();

vs
   auto i = v.begin();

--------------------------------------------------

typeof

Lambda needs to be able to deduce the type of an expression.

   template<class T, class S>
   WHAT_IS_THIS_TYPE? operator+(T &t, S &s)
   { return t+s; }

so we need something of the order of:

   template<class T, class S>
   typeof(S + T) operator+(T &t, S &s)
     { return t+s; }

----------------------------------------------------
  T operator.()

So that I can write smart references. Why? I have "smart"
pointers so that handle shared memory. But in order to use
some std algorithms etc., I need a reference. SmtPtr<T> & isn't
the right thing. So I want to be able to forward the call through
the operator.() to the object.

With this I may be able to use std::allocators. (Or not, but it
would be a step in the right direction.)

---------------------------------------------------
It may already be on your list but:
 
reference reference == reference

  So instead of writing

class foo {
public:
  template<class T>
     foo(typename calling_traits<T>::type t);
};

I could write:

  template<class T>
     foo(T &t);

Where if T is a reference type, I don't have to elude the extra reference.

----------------------------------------------------------
Allow a reference to a non const temporary

currently:

    bind(Myclass::foo, f, c_ref(1 + n)) ;

want:

    bind(Myclass::foo, f, 1 + n);

I'm sure I think up more, but these are the one's that come to mind first.

  -Gary-

  


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk