|
Boost : |
From: Itay Maman (itay_maman_at_[hidden])
Date: 2002-07-21 11:23:07
"David Abrahams" <david.abrahams_at_[hidden]> wrote in message
news:138c01c230bc$cbe3bd00$6501a8c0_at_boostconsulting.com...
> From: "Douglas Gregor" <gregod_at_[hidden]>
>
>
[snip]
>
> That was my understanding also. Incidentally, I recently implemented
> extract<> for Boost.Python.
>
> extract<> is a class template which admits the following uses:
>
> int y = extract<int>(x);
> extract<int> xint((z));
>
> if (xint.check())
> {
> int i = xint();
> ...
> }
> return extract<foo&>(z);
>
> I realize that poses some problems for unification, since it's not
possible
> to non-intrusively customize constructors for a single class template. I'm
> willing to discuss changes, if neccessary.
>
> -Dave
>
(i) Is it in the CVS?
(ii) There's this MSVC namespace-related bug, which makes it impossible to
use extract<T>(x). The workaround I have used so far, is to pass T as a
dummy parameter, i.e: extract(x, boost::type<T>());
I wonder if there are other workarounds which will not affect the interface
of the function?
The program below illustrates the problem. When *1* is uncommented
everything is fine, but if *2* is active, the compiler stops:
"main.cpp(23) : error C2062: type 'int' unexpected"
#include <iostream>
namespace test_site
{
template<typename R>
void func(short )
{
std::cout << "Hi" << std::endl;
}
} // namespace test_site
int main()
{
// using namespace test_site; // *1* - Ok on MSVC6
using test_site::func; // *2* - Err on MSVC6
func<int>(0);
return 0;
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk