Subj : Re: Returning structures from template classes To : borland.public.cpp.borlandcpp From : maeder Date : Sun Oct 02 2005 12:04 pm "DJV" writes: [Too much prose and not enough C++ for may taste; I have great difficulties understanding your problem. At least please illustrate your prose with code or pseudo-code.] > I am trying to return both a matrix and a simple unsigned integer > from a matrix class in a header file to indicate whether a matrix > has been successfully inverted. It occurred to me to use a pointer > to a structure, but two problems developed. Why returning two things at the same time? Is it because to determine whether a matrix is invertible requires you to basically try to invert it? If this is the reason, consider creating an inverter class. E.g.: int main() { typedef matrix matrix_type; matrix_type m(/* some initialization */); matrix_type::inverter i(matrix); if (i.success()) ; // use i.result() else ; // do something else } > 1. In the "main()" body of the calling routine that calls the > matrix class function, I do not seem to be able to create a matrix > object as part of a structure. I can create a matrix object (or > several of them if I wish) in the same "main()" body, but only by > themselves,not as part of a structure. I can not assign the matrix > size in the structure. I can declare a Matrix q, but not a > Matrix q(3,3), as I can outside of the structure. Please show us what you are attempting to do and what the compiler has to say about it. .