Check if something exists or is defined

This is a discussion on Check if something exists or is defined within the C++ Programming forums, part of the General Programming Boards category; Hi, Suppose I want to check if for example a particular struct member is defined and I don't know the ...

  1. #1
    Registered User
    Join Date
    Apr 2006
    Posts
    7

    Check if something exists or is defined

    Hi,

    Suppose I want to check if for example a particular struct member is defined and I don't know the actual members of the struct.

    Here is an example along the same vein where I know the structure of the struct:

    Code:
    struct A {
        int a;
        char c;
    };
    I want to check if say a member called 'd' exists in struct A and if it doesn't print out a message.

    Thanks for any help,
    Tony

  2. #2
    Registered User
    Join Date
    May 2006
    Posts
    903
    I'm afraid you can't do this. Perhaps you can tell us what you are trying to do (or rather, why you are trying to do this) and we can find an alternative.

  3. #3
    Registered User
    Join Date
    Apr 2006
    Posts
    7
    I am trying to use TR1 mem_fn and when using it with a pointer to member data the returned object should not define any nested type names like result_type so I wanted to verify that this was the case and am not sure how to do it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Check application visibility
    By 3saul in forum Linux Programming
    Replies: 2
    Last Post: 02-13-2006, 04:13 PM
  2. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 01:28 PM
  3. How to check if a file exists
    By ElastoManiac in forum C++ Programming
    Replies: 10
    Last Post: 12-05-2005, 04:20 PM
  4. Phantom redefinition
    By CodeMonkey in forum C++ Programming
    Replies: 6
    Last Post: 06-12-2005, 05:42 PM
  5. Function basics
    By sjleonard in forum C++ Programming
    Replies: 15
    Last Post: 11-21-2001, 11:02 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21