User Profile

Collapse

Profile Sidebar

Collapse
card
card
Last Activity: May 30 '10, 02:20 AM
Joined: Jun 2 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • card
    replied to Is a priority_queue dynamic?
    in C
    Hey Jos,

    I agree it isn't psychic. My guess behind the STL algorithm is a top down bubbling for the heap. When I pop the top element, it exchanges the right most leaf node in the heap with the root, puts that leaf at root and bubbles down to maintain the heap. But this still won't guarantee that the heap is proper anymore if I've changed too many keys. Probably a bad question, but I thought I'd ask. The only thing I can do in...
    See more | Go to post

    Leave a comment:


  • card
    started a topic Is a priority_queue dynamic?
    in C

    Is a priority_queue dynamic?

    I was wondering if anyone has a definitive answer on whether the STL priority_queue is dynamic? What I mean by this is best illustrated by a simple example. Suppose I have a priority queue of class called Position with a comparator class called PositionCompare as follows:

    Code:
    priority_queue<Position, vector<Position>, PositionCompare> _pQ;
    Now, I go along and keep inserting Position objects into _pQ....
    See more | Go to post

  • Boxfish, you've come through again! I think I tried every permutation but that one. Many thanks.
    See more | Go to post

    Leave a comment:


  • Member Function of Templated Class Defined Outside Class Body

    Ah, the joy of generic programming. Ok. Here's my problem. I have a templated class with a internally defined structure type. Within the class, I have some member functions whose return value is this structure. I want to define one of these member functions outside the body. An example is this:

    Code:
    template <class T, class E>
    class MyClass
    {
    private:
        T val;
        E key;
    ...
    See more | Go to post

  • card
    replied to Templates and Iterators
    in C
    Yeah, sorry about leaving the "test.h" include in there. Thanks for the reply. Works great.
    See more | Go to post

    Leave a comment:


  • card
    started a topic Templates and Iterators
    in C

    Templates and Iterators

    Hi everyone,

    Can anybody explain why this won't build and what the error is? The error is with the list iterator in the TestClass class. Basically, I have a two templated classes, Item and TestClass. TestClass uses Item to define on of its template parameters.

    Code:
    #include <iostream>
    #include <string>
    #include <vector>
    #include <list>
    #include "test.h"
    ...
    See more | Go to post

  • card
    replied to Templated classes with nested classes
    in C
    Thanks boxfish! I've been pulling my hair out for a couple hours. That did the trick....
    See more | Go to post

    Leave a comment:


  • card
    started a topic Templated classes with nested classes
    in C

    Templated classes with nested classes

    Hi everyone,

    I have a question about referencing a nested class contained within a templated class. Of course the best way to show you is by example. Here's my templated classes:
    Code:
    #include <stack>
    
    template <class T>
    class A
    {
    public:
    
        // constructor
        A(const T &zz): z(zz) {}
        T z;
    
        // nested class
        class
    ...
    See more | Go to post

  • card
    started a topic New Types

    New Types

    Hey Everyone,

    I have a question about new types in Python. *Just finished reading up and
    trying a few things out, but I'm a little confused about one thing. *When
    declaring a new type, we basically have two new structures. *One is the per
    instance structure (your PyObject structure), which is basically an expansion
    of the PyObject structure. *At the beginning of that structure is the macro
    declaration...
    See more | Go to post

  • card
    replied to How can I return an array from C to python
    Did you ever figure this out? I'm new to the forum, but I have the answer if you still need it.
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...