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

Search:

Type: Posts; User: ar115

Search: Search took 0.06 seconds.

  1. [RESOLVED] is const char* to string conversion safe?

    we have a function f with gets a string as below


    void f( std::string str )
    {
    // body
    }


    is it safe to call this function with a const char* varialbe like below
  2. Re: saving an unknown object of POD in binary format

    The binary file used in program is a temporary file that is used during the
    runtime of program. it does not even exist after the end of execution.
    So I think the problems with portability can be...
  3. saving an unknown object of POD in binary format

    I have an unkown object which is guaranteed to contain only POD's as
    its member data.
    Do the template functions below work correctly for saving and retrieval of its data from
    a binary file?

    ...
  4. Re: How to have time out for user input?

    I have found a solution to it in the below page under
    section "Implementing Timers Using Signals"
    http://users.evtek.fi/~tk/rtp/signals-programming.html#catching
    we can use alarm() function call...
  5. Re: How to have time out for user input?

    really need that, any tip is greatly appreciated
    thanks!
  6. Re: How to have time out for user input?

    could anyone tell me what function should I use for unix/linux?
  7. Re: How to have time out for user input?

    Then what should i do for linux & windows cases?
  8. [RESOLVED] How to have time out for user input?

    Hi,
    when using std::cin >> x; for getting a variable from user
    the program is halted until the user inputs something. but
    i want to have a time out (e.g. 10 seconds) which after
    that the program...
  9. Replies
    8
    Views
    12,073

    Re: Problems with writing a metaprogram

    Yes it compiles now!
    Many thanks
    I should go and learn some mpl!
  10. Replies
    8
    Views
    12,073

    Re: Problems with writing a metaprogram

    excellent! I did not know we can do such thing with a few boost::mpl code!

    I added the int main() below to the code and wanted to compile it but i get errors


    int main(){
    Stype::type ts1 =...
  11. Replies
    8
    Views
    12,073

    Re: Problems with writing a metaprogram

    I think you are correct, map binary search is good, and I think it would be fastest if the series of
    left/right comparisons become unrolled at compile time ( again metaprogram! )


    in code it...
  12. Replies
    8
    Views
    12,073

    Re: Problems with writing a metaprogram

    Thanks I did not know about Boost.Assignment
    1- since the number of types T1,T2,... is limited (i'm sure it would be less than 10)
    the map search algorithm becomes a little inefficient compared...
  13. Replies
    8
    Views
    12,073

    [RESOLVED] Problems with writing a metaprogram

    Hi, I have an enum in my program named Stype like below


    enum Stype { T1, T2, T3 };


    There is a template function compute which take two Stype as
    template parameter
  14. Re: I do not why this compiles! confused

    but it also works without setting the value of N like this


    int main(){
    int N;
    int x[N];
    }
  15. [RESOLVED] I do not why this compiles! confused

    Hi,
    I am sure that the size of c style arrays must be known at compile tim
    but the code below compiles. I am using g++ 4.2.4 and really confused!


    int main(){
    int N = 5;
    int x[N];
    x[2] = 3;...
  16. Replies
    6
    Views
    5,060

    Re: a clean macro to make a part of code obsolete

    My code is unstable currently and I want just to disable some part of it without removing it
    maybe i decide to include that part again
    #ifdef is a good solution but I was wondering if there is any...
  17. Replies
    6
    Views
    5,060

    a clean macro to make a part of code obsolete

    Hi
    I have a simple macro which I use when I want to disable part of my code


    #define OBSOLETE_CODE(x)


    But using this macro when you want to make many lines obsolete in not good
    and looks...
  18. Re: Why g++ fails to find correct overload in this case?

    but the signatures of foo::write_binary and global write_binary are different
    so the compiler must be able to choose correct function
    but it erros


    test.cpp: In member function ‘void...
  19. [RESOLVED] Why g++ fails to find correct overload in this case?

    Hi,
    when I want to compile the below i get an error like
    no matching function for call to ...
    from g++


    #include <iostream>
    #include <fstream>
    #include <vector>
  20. Replies
    5
    Views
    3,646

    Re: Best practice to implement this template class

    Many Thanks! it is a good solution
    But is there better ones?
    I was wondering if we can use a nested class and delegate things to it. since we can
    use partial specialization for classes, something...
  21. Replies
    5
    Views
    3,646

    Re: Best practice to implement this template class

    Regarding to my needs I am sure that the above interface is good for me.
    And it is hard for me ( and maybe boring for you ) to tell why I need that
    I need just that to work, is there any good...
  22. Replies
    5
    Views
    3,646

    Best practice to implement this template class

    I have a class which currently contains N vectors of int
    and M vectors of double like below;


    template< int N, int M >
    class VectorCollection {
    std::vector<int> ivec[N];
    std::vector<double>...
  23. Re: static member functions in class templates

    Thanks a lot! it worked
  24. [RESOLVED] static member functions in class templates

    Hi,
    Can anybody help me why this code does not compile (gcc 4.2.4)
    what does the error "invalid operands of types ‘<unresolved overloaded function type>’ and ‘int’ to binary...
  25. [RESOLVED] can operator() be a member function template

    Hello all,

    I want to overload operator() of a class with a template function like below
    //---------------------------
    class A {
    public:

    template< int type >
    void
    operator()() {
Results 1 to 25 of 25





Click Here to Expand Forum to Full Width

Featured