in C++, can I derive a class from a struct
The question says it all really. Am I allowed derive a class from a struct, or should I create a class that embeds my struct and defines copy constructors and an = operator to move between the two? ...
The question says it all really. Am I allowed derive a class from a struct, or should I create a class that embeds my struct and defines copy constructors and an = operator to move between the two? ...
Is there a succinct way to represent a bounded numeric value in .NET 3.5? By this I mean a value such as a percentage (0 - 100) probability (0 - 1) or stock level (0 or above). I would want a ArgumentOutOfRangeException (or equivalent) to be thrown if an out-of-range assignment was attempted. I would also want static MaxValue and MinVa...
A problem I keep running into when writing code that draws images of scientific data is the following: Given some floating point data, fit those data into slots (1-dimensional case) or a grid (2-dimensional case) such that each datum is in the slot or grid entry whose value is closest to the datum's value. It is not the case that the s...
Is there a data type in eVC++ that is the equivalent of __int64? None of the aliases compile. And I cannot find any of the long types in Math.h. A third party library would also be acceptable. ...
I've been pondering this question for a while: Can you build a faster fundamental datastructure (i.e. linked list, hashtable, set, skiplist, bloom filter, red-black tree, etc.) on a multicore machine, by taking advantage of the fact that you've got more than one CPU? I did some preliminary experimenting with pthreads, and found that pt...
I am in the process of converting my Tournament Organizer software, which allows the creation and manipulation of Double Elimination Tournaments, to use the MVVM design pattern so that it can be more easily tested. In doing so, I'm separating out the 'model' from some code in the UI that directly manipulates the bracket structure. This ...
Again me with vectors. I hope I'm not too annoying. I have a struct like this : struct monster { DWORD id; int x; int y; int distance; int HP; }; So I created a vector : std::vector<monster> monsters; But now I don't know how to search through the vector. I want to find an ID of the monster inside the vector. ...
how allocate memory dynamically for the array of stucture.... eg: class students { struct stud { int r_no; char name[20]; }*s; } how to allocate memory dynamically for *s... ...
I'm looking for a concept to store (in 3 dimensional euclidian space) faces, edges and vertex such that information (about relation) isn't duplicated queries for adjecent and neighboring faces/edges/vertex are fast the mesh is not limited to connected faces of the same winding definitions neighbor of a face: the face that shares a...
I have a set of A's and a set of B's, each with an associated numerical priority, where each A may match some or all B's and vice versa, and my main loop basically consists of: Take the best A and B in priority order, and do stuff with A and B. The most obvious way to do this is with a single priority queue of (A,B) pairs, but if there...
Hi, I need to store a sparse matrix on disk. It is like a database table with millions of rows and thousands of columns, where many or most columns are null. It needs to be queryable, like a SQL SELECT with a WHERE on some of the columns. My specific requirement is on Java. I first thought of using Berkeley DB for Java to simulate a tab...
In Real World Haskell, there is a section titled "Life without arrays or hash tables" where the authors suggest that list and trees are preferred in functional programming, whereas an array or a hash table might be used instead in an imperative program. This makes sense, since it's much easier to reuse part of an (immutable) list or tr...
Here are some constraints for a data structure I need. It seems like none of the common data structures (I will mention the ones I've thought of below) fit these all that well. Can anyone suggest one that I maybe haven't thought of? I need to be able to perform lookups by unsigned integer keys. The items to be stored are user-defined...
I need a collection that is like a set. Basically I'm scanning a long string and adding words to the collection but I want to be able to detect when there are duplicates. If sets aren't available, what's the most efficient way of doing this in Ruby? Brownie points for example code. ...
Java's priority queue is a data structure with O(log n) complexity for put (insertion) and O(log n) for poll (retrieval and removal of the min element). C++ STL's multimap has the same functionality but O(1) complexity for retrieval and removal of the min element (begin and erase). Is there an equivalent in Java ? ...
I need a data structure that holds a list of elements of the same type. Needed features are Add GetEnumerator (may be) Clear An indexed access, sorting, searching, removing of elements are not required. What is the best collection class for it? The following aspects should be taken in consideration: performance, memory usage, behavio...
I want to do a breadth first search of a tree using a Queue var q = new Queue<T>(); q.Enqueue(Root); foreach(T root in q) { foreach(T t in root.Children) q.Enqueue(t); } However I get a "Collection was modified after the enumerator was instantiated." Exception. Is there a C# type that I can do this with? Edit: a little rea...
Is there a way to construct a self-referential data structure (say a graph with cycles) in lisp or scheme? I'd never thought about it before, but playing around I can find no straightforward way to make one due to the lack of a way to make destructive modification. Is this just an essential flaw of functional languages, and if so, what a...
I am using JvMemoryData to populate a JvDBUltimGrid. I'm primarily using this JvMemoryData as a data structure, because I am not aware of anything else that meets my needs. I'm not working with a lot of data, but I do need a way to enumerate the records I am adding to JvMemoryData. Has anyone done this before? Would it be possible to so...
Hello. I have n regexes. On input a string i have to find all the regexes that this string matches against. This is normally an O(n) operation: SELECT regex FROM regexes WHERE 'string' RLIKE regex Now I wonder, what's the fastest way to do this ? Are there database, structures or storage systems that are optimized to do such an operat...