General Header-file question

I'm certain that this is a very basic question, but i'm hoping for a little guidance.

NOTE : I'm NOT looking for the answer to any assigned problems for a college course. Just wanted to get that out of the way.

I'm taking a course on C++ programming, and over the course of it I've written a lot of vector manipulation methods (filling, filling with randoms, filling with randoms within a range, a series of sorts, an "is sorted" etc. Very basic stuff I know)

I'd like to create a "Vectormanip" that I can use as a local include. Every time I've created a header file up until now it's been part of a class such as "Timer" or the like where I create a "new" (to me anyhow) kind of object with a series of variables etc.

So what I'm wondering is... what do I call the "class" for this? Can I leave it blank? I'm not sure since I'm only listing a series of methods and not creating a new data structure.

Below is the template I'm using... it's the "class" part that's giving me some pause.

#ifndef VECTORMANIP_H
#define VECTORMANIP_H

/************************************************************/
// System includes

#include <string>
#include <iostream>

/************************************************************/
// Local includes

/************************************************************/
// Using declarations


/************************************************************/

class
{
public:

private:

};

// Place all free function prototypes after the class declaration
// Include only functions that act on the class

/************************************************************/

#endif

/************************************************************/


All the methods work fine, and I'm not looking for any sort of easy answers. This isn't for a project in class... I intend to use it since my prof wants us to only use methods we wrote ourselves. This way I can just include these files and save myself the (admittedly minor) hassle of cut-pasting it into the main .cc file.

Plus this just seems like something that would be worth knowing if I want to go further in C++ programming.

Thanks in advance for all your help.
You don't need to have a class definition in the header.
use code tags please, it helps everything look neater and easier to read.

If these vectors are just functions, place them inside a .cpp class and either:
prototype the functions in a header file
make the functions inline and place them all inside your header file.

Example:

VectorManip.h
1
2
3
4
5
6
7
8
9
10
11
12
#ifndef VECTORMANIP_H_INCLUDED
#define VECTORMANIP_H_INCLUDED

int DotProduct();

inline int FindSize()
{
    //do stuff
    return 0;
}

#endif // VECTORMANIP_H_INCLUDED 


VectorManip.cpp
1
2
3
4
5
6
7
8
#include <iostream>
//other libs.....

int DotProduct()
{
    //do stuff...
    return 0;
}


main.cpp
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
#include "VectorManip.h"


int main()
{
    int stuff;
    stuff = DotProduct();
    stuff = FindSize(); //no prototyping needed
    return 0;
}


If you have a large amount of functions, i would recommend reading up on namespaces and enclosing them in a namespace.
Ah, so I can just include the list of methods and not worry about the class? Much appreciated.
yep, no class is needed
Topic archived. No new replies allowed.