Ticket #29 (closed defect: fixed)
Do not require objects in streams to have defaults constructors
| Reported by: | thomasm | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 1.0 |
| Version: | Keywords: | ||
| Cc: |
Description
The following code does not compile:
#include <tpie/stream.h> class A { A(int b) : a(b) { } int a; }; int main() { tpie::ami::stream<A> t; }
With the following compilation error:
/tpie/bte/stream_stdio.h: In constructor ‘tpie::bte::stream_stdio<T>::stream_stdio(const std::string&, tpie::bte::stream_type, TPIE_OS_SIZE_T) [with T = A]’: /tpie/stream.h:356: instantiated from ‘tpie::ami::stream<T, bte_t>::stream() [with T = A, bte_t = tpie::bte::stream_stdio<A>]’ test.cpp: instantiated from here tpie/bte/stream_stdio.h:130: error: no matching function for call to ‘A::A()’ test.cpp: note: candidates are: A::A(int) test.cpp: note: A::A(const A&)
The problem is that the BTE's assume that the class can be default-constructed, which is not the case for A in my example above. It should be possible to remove this assumptions, but I haven't investigated whether or not it's practical.
Change History
Note: See
TracTickets for help on using
tickets.
