CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: ka3ak

Page 1 of 3 1 2 3

Search: Search took 0.03 seconds.

  1. Thread: double trouble

    by ka3ak
    Replies
    5
    Views
    933

    Re: double trouble

    template <size_t s> struct bound;
    template <> struct bound<2> { static const unsigned int b = 32767; };
    template <> struct bound<4> { static const unsigned int b = 2147483648;...
  2. Thread: random floats

    by ka3ak
    Replies
    9
    Views
    1,389

    Re: random floats

    before calling rand, call srand(time(NULL)) to seed.
  3. Replies
    14
    Views
    1,443

    Re: Help on overloading [] operator

    i am so wrong it's shocking.
  4. Replies
    14
    Views
    1,443

    Re: Help on overloading [] operator

    type-o, my bad
  5. Replies
    7
    Views
    1,064

    Re: String in "Switch Case"

    can't do that. another idea is to switch on the hash value of a string.
  6. Replies
    14
    Views
    1,443

    Re: Help on overloading [] operator

    myclass[5] = 7; <- this calls int& operator [](int i);
    const int x = myclass[5]; <- this calls const int& operator [](int i) const; (or int operator [](int i) const;)
  7. Re: Object size changes between function calls

    could you post your code to get a clearer picture of the problem. thanks!
  8. Replies
    6
    Views
    900

    Re: help regarding insertion sort

    this is about as clear as it gets my friend: (http://en.wikipedia.org/wiki/Insertion_sort)
  9. Replies
    13
    Views
    12,105

    Re: Topological Sort Algrithm

    holy <explative deleted>, that's long! if it works, it works man. bfs = breadth first search (http://en.wikipedia.org/wiki/Breadth-first_search)
  10. Replies
    13
    Views
    12,105

    Re: Topological Sort Algrithm

    how about something like this:


    template <typename T>
    struct vector_builder
    {
    vector<T> m_vec;

    vector_builder() {}
    vector_builder(const T& c) : m_vec(1)
  11. Replies
    7
    Views
    845

    Re: multiple definition

    put this both places where you include your c-library. this is by no means elegant, but it'll work.


    #if !defined(_include_once_)
    # include "c-library.h"
    # define _include_once_
    #endif
  12. Replies
    10
    Views
    1,123

    Re: Maze Program - What am I doing wrong?

    try compiling and running in debug, it might point you to the exact line where the error occurs. (press f5 if you're using VS)
  13. Replies
    13
    Views
    12,105

    Re: Topological Sort Algrithm

    taking the "s -> A, D, G" statement alone. i'm going to assume it means s is adjacent to A, D, and G - so outdegree of 3, and A, D, and G have indegree of 1 each. so take it one step at a time - if...
  14. Replies
    11
    Views
    1,465

    Re: Ambiguous function overloading

    the second case isn't ambiguous because you're not passing in a const int. the first case is a little trickier. when you pass by const value (func(const int i)), the const is applied to the copy of...
  15. Replies
    3
    Views
    694

    Re: Syntax Errors that make no sense

    while( i; i != sizeof(out); ++i ){


    you probably meant to use a for loop.
  16. Replies
    3
    Views
    614

    Re: Help with Inheritance

    i think it is referred to as "the most vexing parse problem", might be worth checking it out. (http://www.gotw.ca/gotw/001.htm)
  17. Replies
    3
    Views
    6,200

    Re: mutex and pthread

    you can call pthread_join(...) to wait for the threads to finish before destroying the mutex. (http://www.opengroup.org/onlinepubs/007908799/xsh/pthread_join.html)
  18. Replies
    7
    Views
    5,708

    Re: Finding an element in infinite sorted array

    oh, i'm sorry, i read that as finite. your solution is the right one
  19. Replies
    7
    Views
    5,708

    Re: Finding an element in infinite sorted array

    there's no need to do the first step, implement a comparison operator where +infinity is always greater than any number and do a bin search on the whole array.

    lets say the array is all ints and...
  20. Replies
    7
    Views
    1,319

    Re: vector of pointers iterator

    you were trying to call ->image on the pointer to Piece*. if you made the array of Piece objects, the iterator would be a pointer to one of the objects, so you could use -> operator. the way you did...
  21. Replies
    7
    Views
    1,319

    Re: vector of pointers iterator

    an iterator is more or less a pointer, in your case it's a pointer to a Piece* (pointer to a pointer), so you need to dereference it to get to the actual Piece*, then you can use the -> operator.
  22. Replies
    13
    Views
    833

    Re: Problem with a virtual member call

    and this is why i didn't disagree with you, but there are, although few, several cases :thumb:
  23. Replies
    16
    Views
    1,462

    Re: C++ Newbie - Derived Class Issue

    and this:



    class X

    {
    int a;

    int b;
  24. Replies
    13
    Views
    833

    Re: Problem with a virtual member call

    no rolls royce can go through rough sand/mud/rocks/water. an 80s Toyota FJ or Land Cruiser can though. pick the right tool for the right job.
  25. Replies
    16
    Views
    1,462

    Re: C++ Newbie - Derived Class Issue

    and all this time i thought it was a personal preference thing, hmmmm :blush:
Results 1 to 25 of 61
Page 1 of 3 1 2 3





Click Here to Expand Forum to Full Width

Featured