Thread: Does this class look fine?

  1. #16
    Registered User
    Join Date
    Apr 2008
    Posts
    610
    Quote Originally Posted by matsp View Post
    Ah, yes. If a function is not a template or inline, it probably (as in, with very few exceptions) should go in a .cpp file. In this case, I don't see any reason why they should NOT be declared in valid.h, and then implemented in valid.cpp.

    --
    Mats
    as in...

    Code:
    // Validate.h
    
    namespace valid
    {
    
    	bool driverIDValidator(const std::string& id);
    
    }
    
    // Validate.cpp
    
    #include "Validate.h"
    
    bool valid::driverIDValidator(const std::string& id);
    {
    	static const boost::regex e("^[0-9]{6}[0-9]{4}[0-9]{3}$");
    	return regex_match(id, e);
    }
    ??

  2. #17
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Yup, something like that.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #18
    Registered User
    Join Date
    Apr 2008
    Posts
    610
    Quote Originally Posted by matsp View Post
    Yup, something like that.

    --
    Mats
    I always get a bit suspicious when some1 gives an answer containing "something like that", but thanks

  4. #19
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    No suspicion there. It's correct. No problems. No errors.
    It's as I would like to call it - "by the book"!
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  2. Creating a database
    By Shamino in forum Game Programming
    Replies: 19
    Last Post: 06-10-2007, 01:09 PM
  3. Mmk, I give up, lets try your way. (Resource Management)
    By Shamino in forum Game Programming
    Replies: 31
    Last Post: 01-18-2006, 09:54 AM
  4. class errors
    By romeoz in forum C++ Programming
    Replies: 3
    Last Post: 09-16-2003, 07:57 PM