Search:

Type: Posts; User: cunnus88

Page 1 of 12 1 2 3 4

Search: Search took 0.01 seconds.

  1. So if I want to partially specialize it just for...

    So if I want to partially specialize it just for K, then it would be


    template<typename T> template<>
    typename void A<T>::foo(double)(){}


    Is that correct?
  2. Wow. A hunch I had is actually right. But that...

    Wow. A hunch I had is actually right. But that syntax is pretty funky. I mean


    template<> template<>

    Really?
  3. How do you specialize a template function in a template?

    Say you have:



    template <typename T>
    class A {
    template <typename K>
    void foo(T, K);
    };
  4. Replies
    8
    Views
    9,779

    You can do that in Java because enums are class...

    You can do that in Java because enums are class objects there, but enums in C/C++ are just souped up const ints, so if you print it, all you're going to get is a number. You'll have to write your own...
  5. Replies
    6
    Views
    829

    Oh wow. That worked. Thanks Elysia. You're a...

    Oh wow. That worked.

    Thanks Elysia. You're a programming master! How the hell do you know every thing?
  6. Replies
    6
    Views
    829

    Could you tell me how? I've looked at several...

    Could you tell me how? I've looked at several articles on template specialization and it doesn't seem as if specialization of template member functions is possible. I've tried some variations myself...
  7. Replies
    6
    Views
    829

    Sorry, I didn't give full details. The template...

    Sorry, I didn't give full details. The template node itself is subsumed under several other classes in different ways. Like


    template<typename T>
    class OneClass {
    node<T> one_node;
    };
    ...
  8. Replies
    6
    Views
    829

    There has got to be a better way

    It's a solution I came up with to a template specialization problem which is really crappy. And if there are any other, better, cleaner ways to do it, please enlighten me.

    I have a templated node...
  9. You need a stop condition for your "for" loops....

    You need a stop condition for your "for" loops. Instead of


    for (int m=1; str[m]; m=m+2)

    it should be


    for (int m=1; m<9; m=m+2)
  10. True. Consistency is important.

    True. Consistency is important.
  11. My previous understanding was that static member...

    My previous understanding was that static member variables have to be defined outside the class body, not just declared. Isn't a statement like


    int A::x;

    allocating memory as well, and...
  12. After some googling and tinkering, I've found a...

    After some googling and tinkering, I've found a solution, but I can't say I understand why it works.



    // in a header file
    template <typename T>
    class A {
    static stl_container<T*>* container;...
  13. Linking error with static template class members

    The more I think about it, the more I have a feeling I have to change my design but here's the problem, anyway.

    I have a templated class. This class has a static class member variable, which is a...
  14. Yeah, you're right. The more I think about it, it...

    Yeah, you're right. The more I think about it, it seems that I need to rethink my design.
  15. Covariance with virtual functions and stl containers

    I have two classes, one derived from the other, and a virtual get function is supposed to return a pointer to a container with different element types depending on who's getting called. Simplified:
    ...
  16. Replies
    4
    Views
    1,934

    Yes, you are. Smile. (Do you honestly expect a...

    Yes, you are. Smile. (Do you honestly expect a civilized answer responding with crap like that?)
  17. Replies
    4
    Views
    1,934

    Destructor being called on SGI hash_map key

    I'm using the hash_map that comes with gcc 4.0 (i.e. <ext/hash_map>) and I have no idea why the destructor is being called on a key object.

    I have a class object for which I've defined a hash...
  18. So if I don't have a corresponding "delete"...

    So if I don't have a corresponding "delete" statement in some_function, this is a memory leak?

    So I guess if you have a function that takes a pointer parameter, but has no idea where the...
  19. What happens to dynamic objects that are instantiated as parameters?

    If there were code like


    beginning_of_scope
    some_function(new some_object);
    end_of_scope


    What happens to the new instance of some_object after exiting end_of_scope? Is it freed...
  20. Replies
    8
    Views
    1,861

    I discovered this just now. My compiled fine on...

    I discovered this just now. My compiled fine on my Mac with gcc 4.0, but when I tried to compile it on a Linux machine with gcc 4.2.2, it popped an error message. I'll just write code for standard...
  21. Replies
    8
    Views
    1,861

    Thanks. I had misunderstood how accumulate...

    Thanks. I had misunderstood how accumulate functions. Now I know better.
  22. Replies
    8
    Views
    1,861

    bind2nd problems

    I'm trying to implement a standard deviation routine using templates but I hit a snag with the bind2nd operator and I just don't get it:



    template<typename T> struct minus_squared
    : public...
  23. Is what I think is gonna happen gonna happen

    I'm trying to get rid of some inefficiencies in my code. The current (simplified) version is this:



    class matrix {

    double data*;

    matrix& operator=(const matrix& m) {
  24. Replies
    1
    Views
    965

    clearing error flags on streams

    I had to interface with zlib so I downloaded a thing called gzstream from http://www.cs.unc.edu/Research/compgeom/gzstream/

    The problem is that when I try to reset the EOF flags on an igzstream...
  25. Thread: namespace tm?

    by cunnus88
    Replies
    3
    Views
    1,180

    Thanks! That makes sense.

    Thanks! That makes sense.
Results 1 to 25 of 276
Page 1 of 12 1 2 3 4