Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost TraitsType Question
From: Marshall Clow (mclow.lists_at_[hidden])
Date: 2012-10-04 18:52:04


On Oct 4, 2012, at 3:19 PM, "Rawate, Vishal CIV NAVAIR-WD-5-2-7-1-1-0-E., 527110E" <vishal.rawate_at_[hidden]> wrote:

> Yes Function overloading or Template specialization would work. Bu again all the functions have to perform the same tasks just the types are different.
>
> For example I would like to do this.
> Template<typename T>
>
> Void setTag(T myVariable)
> {
> If(T == short)
> {
> myType = short;
> }
>
> If(T == long)
> {
> myType = long;
> }
> }

I'm afraid I don't get what you're doing.
Maybe you need to show a more concrete example.

Is "MyType" a type?

If so, why not just say:
        typedef T MyType;
and be done with it?

-- Marshall

Marshall Clow Idio Software <mailto:mclow.lists_at_[hidden]>

A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
        -- Yu Suzuki


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