Results 1 to 2 of 2

Thread: [RESOLVED] Identifying Types

  1. #1

    Thread Starter
    Hyperactive Member GamerMax5's Avatar
    Join Date
    Nov 2004
    Location
    United States
    Posts
    388

    Resolved [RESOLVED] Identifying Types

    I think I remember reading somewhere how to do this but I can't remember how to for the life of me now that I need to do it. Figures huh?

    I have a method that uses generics for a parameter. It's purpose is to output necessary information about an object to either the console (debugging) or to the window as needed. However I need to be able to identify the base type of the incoming parameter inside the method and I can't remember how to do that.

    Here's a skeleton of the method:

    Code:
    template <typename T>
    void displayObjectInfoConsole(T inObject) {
    }
    Is this something I can use RTTI for or am I thinking in the wrong direction?
    Last edited by GamerMax5; Dec 19th, 2008 at 07:16 PM.

  2. #2

    Thread Starter
    Hyperactive Member GamerMax5's Avatar
    Join Date
    Nov 2004
    Location
    United States
    Posts
    388

    Re: Identifying Types

    I resolved my issue. It's called template specialization. Nice when you find out everything about templates finally.

    Although this solution still seems a little... I don't know... hefty in terms of writing extra code for each individual possible type that can be passed to the method (I'm talking UDTs not base types).
    Only those who try will become.

    Find me on identi.ca

    Twitter @gfmartin05

    Linux Wrap

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width