6 May
2009
6 May
'09
4:55 p.m.
2009/5/6 dariomt
Roman Perepelitsa
writes: 2009/5/6 Roman Perepelitsa
It's less efficient, because all arguments will be copied. It's also more typing, longer compilation times and more code generated.
There is one more caveat. This approach does not work with polymorphic
types (you'll get slicing). I don't think there are any advantages in passing boost::optional<T> compared to const T*.Roman Perepelitsa.
Thanks for the answer!
Is there a way to avoid the copy (and thus the slicing)? Perhaps using boost::optional
or boost::optional< boost::reference_wrapper<T> > ?
You can use boost::optional