An open source utility library

I want to share this library I'm making in c++ on BitBucket. You'll find any info inside the repository:

https://Taglialegna@bitbucket.org/Taglialegna/utility-library-cpp.git

Feel free to make branches, I'd like to create a new library with any sort of useful functions for everyday programming.
Last edited on
Why all the pointers? IMO, you should be passing by reference/const reference instead.

Why the class? Wouldn't just putting the functions in a namespace be better?

If you want people to use your formatting style you should be consistent about your indentation and whitespace.

At least one of your functions can be simplified, or just removed altogether.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void util::changeState(bool* variable){
	if(*variable){	//variable = 1, so change it to 0 (true to false)
		//*variable = 0;
		*variable = false; 
	}
	else{			//variable = 0, so change it to 1 (false to true)
		*variable = 1;
	}
}
// The above function could be simplified to something like:
void util::changeState(bool& variable){
    variable = ~variable;  // Change the state of the value.
}
//Also I would consider returning the value, and passing the value by value.
bool util::changeState(bool variable){
    return ~variable;
}
// This way the user can control whether or not to change the value being passed, or to assign the changed value into another variable.
    bool bool_value = true;
    bool new_bool_value = util::changeState(bool_value);


You have a function with bool values, why are you using 0, 1 instead of true, false?
util::normalize() divides by zero if all elements in the input are zero.
Topic archived. No new replies allowed.