Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

"using" declaration and template (generic) classes

0 views
Skip to first unread message

Kevin Frey

unread,
Nov 8, 2009, 6:37:38 PM11/8/09
to
Hello All,

I want to refer to the Nullable< T > template type in C++/CLI (a header
file) without requiring explicit qualification of the System:: namespace.

So I effectively want to do this (which won't actually compile):

using System::Nullable< T >; // or something to this affect

class MyClass
{
property Nullable< int > MyProperty
{
// ...
}
};

I can't find the right syntax to do this - yes I could use using namespace
System and yes I could qualify the typename (which I have done for the
moment as a workaround).

But it's now an academic exercise for me. Is it possible for a using
declaration to reference a generic class, and what is the syntax?

Nothing I have tried works, such as:

using System::Nullable< T >;
using System::Nullable< typename >;
using System::Nullable< typename T >;
template< typename T > using System::Nullable< T >;

And I can't find anything online or in the documentation.

Thanks

Kevin


Carl Daniel [VC++ MVP]

unread,
Nov 8, 2009, 8:52:12 PM11/8/09
to
"Kevin Frey" <kevin_...@hotmail.com> wrote in message
news:us#L2xMYK...@TK2MSFTNGP06.phx.gbl...

> But it's now an academic exercise for me. Is it possible for a using
> declaration to reference a generic class, and what is the syntax?

AFIAK, no, it's not possible - there's no syntax for using to bring an
un-specialized generic into scope.

-cd

Ben Voigt [C++ MVP]

unread,
Nov 9, 2009, 9:00:55 PM11/9/09
to

"Kevin Frey" <kevin_...@hotmail.com> wrote in message
news:us#L2xMYK...@TK2MSFTNGP06.phx.gbl...

Maybe typedef would work better.

>
> Thanks
>
> Kevin
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4590 (20091109) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4590 (20091109) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

0 new messages