Fast, templated, C++ Octree implementation

http://nomis80.org/code/octree.html This is my favorite. It is GPL and has it’s own homepage, so it’s meant to be used by others. It has Doxygen documentation, and the authors are taking questions. http://www.flipcode.com/archives/Octree_Implementation.shtml This one is not templated. It has more comments in the code than every other I’ve seen, so that might be more useful … Read more

C++ Private Structures

Yes structures can have private members, you just need to use the access specifier for the same. struct Mystruct { private: m_data; }; Only difference between structure and class are: access specifier defaults to private for class and public for struct inheritance defaults to private for class and public for struct How can you access … Read more

Print the structure fields and values in C

What you’re looking for is reflection. Java and other virtual languages has reflection so you can print out the variable names and function names for any given class. Because the compiler builds these reflection functions automatically. C does not have reflection. You must do everything manually.

Writing Structs to a file in c [closed]

Is it possible to write an entire struct to a file Your question is actually writing struct instances into file. You can use fwrite function to achieve this. You need to pass the reference in first argument. sizeof each object in the second argument Number of such objects to write in 3rd argument. File pointer … Read more

Tree implementation in Java (root, parents and children)

import java.util.ArrayList; import java.util.List; public class Node<T> { private List<Node<T>> children = new ArrayList<Node<T>>(); private Node<T> parent = null; private T data = null; public Node(T data) { this.data = data; } public Node(T data, Node<T> parent) { this.data = data; this.parent = parent; } public List<Node<T>> getChildren() { return children; } public void setParent(Node<T> … Read more

Padding in structures in C

I don’t think there’s an advantage for any of this structures. There is one(!) constant in this equation. The order of the members of the struct is guaranteed to be as declared. So in case like the following, the second structure might have an advantage, since it probably has a smaller size, but not in … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)