Search:

Type: Posts; User: skewray

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    11
    Views
    641

    Great. I and my open source project thank you all...

    Great. I and my open source project thank you all for your help.
  2. Replies
    11
    Views
    641

    Would this be considered good coding practise?...

    Would this be considered good coding practise? Seems like a very clever way to make unmaintainable code.
  3. Replies
    11
    Views
    641

    The fundamental problem was that I assumed that...

    The fundamental problem was that I assumed that when the compiler saw "*T = *X", it would magically know, through polymorphism, that X was an "intersection" and use X's copy semantics. Since the...
  4. Replies
    11
    Views
    641

    The history of this is that I have code that...

    The history of this is that I have code that works fine, except that there is one polymorphic function that has identical code for every subclass. I am trying to refactor and put the code into...
  5. Replies
    11
    Views
    641

    copy assignment of polymorphic classes

    I have noticed that when using the default copy assignment for a virtual polymorphic class, I do not get the behaviour I expect. Although copy assignment of the derived class works fine, copy...
  6. Replies
    4
    Views
    592

    Thanks, laserlight. Id did have a stupid type on...

    Thanks, laserlight. Id did have a stupid type on there. What I originally couldn't get working was when the class is itself a template:



    template <int N>
    class myclass
    {
    public:
    ...
  7. Replies
    4
    Views
    592

    template functions as member functions

    I want to have a template function that is a member of a class. Is this possible? This code snippet is how I would think the syntax would go, although it doesn't compile. How would I achieve the...
  8. Replies
    2
    Views
    1,447

    Thanks!

    Thanks, that definitely works. I never would have come up with the syntax, although now that I've seen it, I understand where it comes from.

    Brian
  9. Replies
    2
    Views
    1,447

    initializing static stdlib containers

    If I wanted to count how many objects of a class I make, I could write


    // header.hh

    class bob
    {
    public:
    bob() ;
    private:
  10. Replies
    8
    Views
    1,307

    I assume that since I can figure out that it is a...

    I assume that since I can figure out that it is a typename without the help of the extra keyword, this means that the compiler parser needs more than one token of look-ahead in order to figure out...
  11. Replies
    8
    Views
    1,307

    That works much better. Thanks, although I...

    That works much better. Thanks, although I actually don't understand what the addition of the typename keyword does.

    Wouldn't returning a reference to a vector then be implementation dependent? ...
  12. Replies
    8
    Views
    1,307

    Adding iterators to a class template

    I am trying to add an iterator to a class template. The class is not much more than an encapsulated standard library vector, which some added features. The compiler chokes pretty hard on the...
  13. Replies
    7
    Views
    2,899

    Ah, that works much better. Thanks! I used to...

    Ah, that works much better. Thanks! I used to use ar, but I decided I wanted to simplify my build procedure by having each subdirectory make one object file, and then combine those at the top...
  14. Replies
    7
    Views
    2,899

    g++ -r Confusion

    I want to take all of the C++ object files in a directory and ball them up into one object file.
    I tried "g++ -r -o out.o in_1.o in_2.o ...", but I get the error message "/usr/bin/ld: cannot find...
  15. Instituting binary search, please wait......

    Instituting binary search, please wait... -Wunreachable-code. Here is the manual entry on it:

    -Wunreachable-code
    Warn if the compiler detects that code will never be executed.

    ...
  16. Fog is lifting here. The construction you give...

    Fog is lifting here. The construction you give rings a bell.

    So the only remaining question is, what do all of these other warnings mean, and how do I know that I can ignore them in the future? ...
  17. Replies
    23
    Views
    2,905

    The answer is yes, but it will take more lines of...

    The answer is yes, but it will take more lines of code than you expect. You create a class with the basic type you are modifying as a private member, and then add all the functionality you want to...
  18. Strange gcc warning messages with derived classes

    Hello! I am using gcc 4.1.2 to compile the following code. The base class just makes sure that freed instances are not referenced, and might warn of wild pointers. The label is just a derived...
  19. Replies
    22
    Views
    5,405

    Great recommendations! I was looking for more...

    Great recommendations! I was looking for more leads into good books.
  20. Replies
    22
    Views
    5,405

    My ultimate motivation for asking is less...

    My ultimate motivation for asking is less performance than learning C++. I just read "Design Patterns" by Gamma et al., and I found most of the patterns incomprehensible, except for the few I had...
  21. Replies
    22
    Views
    5,405

    The motivation for my question was that I have...

    The motivation for my question was that I have read that using RTTI is inherently slow. I haven't done actual runtine comparisons, though; runtime may be compiler dependent anyway. The alternate...
  22. Replies
    22
    Views
    5,405

    Eliminating dynamic_cast

    I have a polymorphic set of classes, and I want to have a virtual comparison function. Right now each of the derived classes has a function that looks something like this:



    bool...
  23. Thread: 12 tone matrix

    by skewray
    Replies
    2
    Views
    3,046

    "double C = 261.626 * 2;" is not the best...

    "double C = 261.626 * 2;" is not the best programming style. "261.626" is a completely arbitrary number. Better is:


    double A1 = 440.0; // standard...
  24. Replies
    13
    Views
    1,297

    Well, I still haven't found this forum, but I'm...

    Well, I still haven't found this forum, but I'm going to keep looking...
  25. Replies
    153
    Views
    218,951

    Sticky: A Negative Recommendation

    C++ for C Programmers by Pohl is a dog. Each edition is worse that than the previous.
Results 1 to 25 of 36
Page 1 of 2 1 2