|
Boost : |
From: Michael Tegtmeyer (tegtmeye_at_[hidden])
Date: 2007-05-30 19:58:06
> I tried using the .h file as-is in msvc 8.0 but got a bunch of compile
> errors on the test code provided in your e-mail. Maybe it doesn't
> make sense to do that, sorry I'm not too familiar with configure/make.
> I downsized the test code to where it did something pretty simple
> (declared a cvalarray using the default consructor and printed its
> values). Anything beyond that and errors come up.
OK, I did some checking and I believe the compile errors on MSVC is a
language non-conformance bug in MSVC.
Specifically, VC++ reports an ambiguity error for the following code:
#include <iostream>
template<typename T, int N>
struct foo {
foo(const T *t) {std::cerr << "const T *t called\n";}
foo(const T (&t)[N]) {std::cerr << "const T (&t)[N] called\n";}
};
int main()
{
int a[10];
foo<int,10> f(a);
return 0;
}
GCC, SUNForte, and others compile this fine.
MSVC seems to erroneously decay the array argument in f's constructor even
though one of the options is a constant array parameter. Vandevoorde(C++
Templates, pg 59) discusses this further.
In any case, the decision to stray from std::valarray's interface in this
area was an arbitrary one so it is easy to chose the other option. The
interface now mimics std::valarray for single value as well as pointer
arguments in that they require a size parameter.
The test cases and docs have been updated and the new version
(cvalarray-.1.3.tar.gz) is now in the vault.
I have also included MSVS project files located in the 'tests' directory
that will run all 24 tests. I do not use MSVS much so I don't promise that
it is elegant.
Mike
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk