Boost logo

Boost Users :

From: speedsnaii speedsnaii_at_[hidden])
Date: 2003-02-26 07:09:25


Hi Joerg, first let me thank you for beeing so helpful.

|> But this still leaves me with even more questions:
|>
|> Why would I prefer:
|>
|> template<class E>
|> void foo(const vector_expression<E>& arg)
|> {
|> arg().size();
|> }
|>
|> over
|>
|> template<class V>
|> void foo(const V& arg)
|> {
|> arg.size();
|> }
|>
|> ?
 
| You could overload foo() for vector_expression<> and
matrix_expression<>
| then. Sorry for giving the second hint first ;-)

Do you mean for the sake of getting better error diagnostics when I
supply a completely unrelated type to foo? As i.e. foo(3.15)? Or did
I misunderstand you?

|> ... <snip> ...

| You've lost me. Above you've pointed out both ways to declare
generic
| functions foo().

Ok, I think I understand this now.

| Are you talking about the implementation of foo() now?

Yes it seems so. Using either declaration will result in a separate
overloaded function. (Is this referred to as code bloating?) But all
I need is access to operator[] (and similar), operator(n,m), size1/2
() and the value_type basically. This is why I tried first to
formulate my algorithm in terms of iterators. Somehow I am trying to
discard the expression type info I think, since I am only interested
in the common member functions, that let me see it as a container.
Could I write a kind of vector and matrix proxy that is able to
acomplish this? Would you recommend or not to take this route?

BTW.: I am not sure exactly what comprises the user interface to the
uBLAS. Is this what is in the documentation? Then what is
vector_reference for? Why is vector_constant_reference not available
and what is its purpose? Could this class be of help in my case?

|> Could you Joerg or anyone else give me some ideas of how
|> to do this (conceptually simple) task or point me to some example
|> code?
 
| I believe, I've answered this one already:
 
| http://groups.yahoo.com/group/Boost-Users/message/3028
|
| (see the bottom of the posting). Anything wrong with that?

Oh, sorry I somehow overlooked this message. Thank you.

Regards,
Roland


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net