Thread: Input class project (again)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #17
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    It seems difficult to implement this as functions unless there are many
    That was probably poorly worded, but I remembered its meaning now. I was trying to express that it might be difficult to implement as functions, unless I would create and overload lots of free functions instead of like wrapped in one class.
    But you are right - I will try to break this into free functions.

    As for the rest of the feedback...
    1 & 2) Yes, my mistake. Although by just storing the parameters in the constructor and putting all the code inside the operator >>, I might eliminate those two. I think. Good to remember.
    3) It's likely a relic... it was supposed to be used. At least later. But in this experimental implementation, I did not substitute cout, cin, etc.
    4) For some reason VS just complains "2>error C2660: 'Input<DataT>::Input' : function does not take 3 arguments". Now what I had expected...
    5) That is a good idea.

    Anyway, this was sort of what I wanted to encapsulate in functions or a class. Now the problem is just to discover if it's feasible to make as free functions.

    UPDATE:
    I managed to implement them as free functions.
    The only problem I see now (that I did not see before), is some more template trickery to select a proper string type to store data in. I'm considering std::basic_string<T>, but it would require me to fetch the base-type of the string template parameter.
    I put a comment there. Before the std::getline function.
    Hopefully this is a good approach.
    Last edited by Elysia; 01-09-2009 at 12:49 PM.
    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. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. deriving classes
    By l2u in forum C++ Programming
    Replies: 12
    Last Post: 01-15-2007, 05:01 PM
  3. Trouble with a lab
    By michael- in forum C Programming
    Replies: 18
    Last Post: 12-06-2005, 11:28 PM
  4. Creating class object from user input?
    By Munkey01 in forum C++ Programming
    Replies: 8
    Last Post: 01-05-2003, 10:09 AM
  5. My final project for programming class...
    By Leeman_s in forum C++ Programming
    Replies: 3
    Last Post: 12-20-2001, 04:34 PM