Added default constructor for cons<>.

[SVN r10967]
This commit is contained in:
Dave Abrahams
2001-08-30 14:44:24 +00:00
parent 0b8d721265
commit 588a6eeb1b

View File

@ -22,6 +22,9 @@
// William Kempf, Vesa Karvonen, John Max Skaller, Ed Brey, Beman Davis, // William Kempf, Vesa Karvonen, John Max Skaller, Ed Brey, Beman Davis,
// David Abrahams. // David Abrahams.
// Revision history:
// 2001 08 30 David Abrahams
// Added default constructor for cons<>.
// ----------------------------------------------------------------- // -----------------------------------------------------------------
#ifndef BOOST_TUPLE_BASIC_HPP #ifndef BOOST_TUPLE_BASIC_HPP
@ -226,6 +229,10 @@ struct cons {
typename tuple_access_traits<tail_type>::const_type typename tuple_access_traits<tail_type>::const_type
get_tail() const { return tail; } get_tail() const { return tail; }
cons()
: head(detail::tuples::default_arg<HT>::f()), tail()
{}
cons(typename tuple_access_traits<head_type>::parameter_type h, cons(typename tuple_access_traits<head_type>::parameter_type h,
const tail_type& t) const tail_type& t)
: head (h), tail(t) {} : head (h), tail(t) {}
@ -293,7 +300,11 @@ struct cons<HT, null_type> {
get_head() const { return head; } get_head() const { return head; }
const null_type get_tail() const { return null_type(); } const null_type get_tail() const { return null_type(); }
cons()
: head(detail::tuples::default_arg<HT>::f())
{}
cons(typename tuple_access_traits<head_type>::parameter_type h, cons(typename tuple_access_traits<head_type>::parameter_type h,
const null_type& = null_type()) const null_type& = null_type())
: head (h) {} : head (h) {}