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

Search:

Type: Posts; User: Plasmator

Page 1 of 36 1 2 3 4

Search: Search took 0.04 seconds; generated 32 minute(s) ago.

  1. Replies
    10
    Views
    1,413

    Re: can i force compiler to use 64 bit int?

    It doesn't matter what your compiler is willing to swallow -- this sort of thing is explicitly forbidden by the standard.

    If you're writing portable and well-defined code, you mustn't do this.
  2. Replies
    10
    Views
    1,413

    Re: can i force compiler to use 64 bit int?

    That's absolutely illegal. You are not permitted to define macros with names identical to language keywords.

    assert takes one argument; I think you meant assert((expression) && "string-literal"),...
  3. Replies
    8
    Views
    1,924

    Re: Preprocessor tricks

    What templates?

    Simulated recursion.

    Quite easily generated:


    #!/usr/bin/perl
    use strict;
    use warnings;
  4. Replies
    8
    Views
    1,924

    Re: Preprocessor tricks

    Yes, it will.

    You clearly don't understand how BOOST_PP_REPEAT works, then.
  5. Replies
    8
    Views
    1,924

    Re: Preprocessor tricks

    It's trivial to implement, albeit the code can become quite bulky (if done in a reusable manner).
    Luckily, most of the legwork has been written for you already (see the Boost.Preprocessor library):...
  6. Replies
    12
    Views
    1,707

    Re: std::string all numeric

    Easier to just use isdigit directly:
    bool check_string_numeric(const std::string& str)
    {
    return (std::find_if(str.begin(), str.end(), std::not1(std::ptr_fun(::isdigit))) == str.end());
    }If...
  7. Replies
    2
    Views
    2,237

    Re: Converting txt file contents to char array

    A little easier, IMO:


    std::ifstream in("...");

    typedef std::istreambuf_iterator<char> in_t;

    std::string buffer((in_t(in)), in_t());
    EDIT: It's probably also worthwhile to mention that...
  8. Replies
    3
    Views
    764

    Re: breaking out of a loop

    In this particular case, all that was required of you was to explicitly return from main when a + b + c == 1000.

    If your ultimate goal is to find the triplet that satisfies the condition outlined...
  9. Re: void value not ignored as it ought to be

    See the MSDN entries for srand and rand. Ignore the MS-specific parts (e.g., *_s versions), of course.

    I don't know what kind of "tutorial" you're expecting because it doesn't get any simpler than...
  10. Re: void value not ignored as it ought to be

    Why are you looking at srand when your error is related to rand?

    Regardless, rand takes no arguments.
    You, on the other hand, are trying to pass something to it. That's what's causing your...
  11. Re: void value not ignored as it ought to be

    Link, please.

    As usual, your best references are the C (ISO/IEC 9899) and/or C++ (ISO/IEC 14882) standards. Their respective drafts are available online for free.

    Your compiler already did...
  12. Re: void value not ignored as it ought to be

    Start by reading the documentation. Trial and error usually doesn't work in programming.
  13. Re: void value not ignored as it ought to be

    Uh, check srand's signature. What you're doing makes no sense. You probably intended to write rand, instead.
  14. Re: Overloading a matrix constructor for 1 and 2 dimensional arrays.

    With respect to exclusively supporting stack-based arrays, sure (untested):

    template< typename T, class Container = std::deque<T> > class Matrix
    {
    public:
    template<std::size_t X>...
  15. Replies
    63
    Views
    7,141

    Poll: Re: Were you taught debugging

    Not really, no.

    Not even preventative measures (e.g., [static] assertions) were covered. :sick:
  16. Replies
    10
    Views
    2,949

    Re: remove_if (not)

    That's what std::ptr_fun from the functional header's for.
  17. Replies
    11
    Views
    2,161

    Re: Removing characters from a string

    You should prefer to use standard algorithms wherever possible. All of that crap can be replaced by a one-liner involving std::remove_if and std::isspace:

    txt.erase(std::remove_if(txt.begin(),...
  18. Replies
    2
    Views
    591

    Re: Detecting another process

    This isn't the right forum for this sort of question.

    Assuming that you're targeting a reasonably modern OS (i.e., Win2k+), take a system snapshot with CreateToolhelp32Snapshot and walk through it...
  19. Replies
    56
    Views
    25,618

    Re: class constructor question

    JohnW@Wessex's getting at the same thing.
  20. Replies
    5
    Views
    642

    Re: Help Please before i go crazy!!!!

    Just like kindergarten arithmetic...

    For integers:
    1 / 2 = 0
    2 / 2 = 1
    3 / 2 = 1
    4 / 2 = 2
    5 / 2 = 2
    6 / 2 = 3
    7 / 2 = 3
  21. Replies
    56
    Views
    25,618

    Re: class constructor question

    You're missing the ****ing point.
    When you pass T by-value, T's copy constructor gets invoked. In your case, over and over and over. In short, impossible. Passing T by (const) reference alleviates...
  22. Replies
    56
    Views
    25,618

    Re: class constructor question

    Sigh... Let's try this again.

    What gets invoked when you pass by-value?
  23. Replies
    56
    Views
    25,618

    Re: class constructor question

    Obviously it's not.

    First, you can't pass test by-value in your copy constructor. Think about it, the reason should be quite obvious (HINT: what happens when you pass something by-value?)....
  24. Replies
    19
    Views
    14,298

    Re: return function

    That's a good thing.

    Pure luck.

    const-qualification in this context doesn't matter much. The point of the snippet was to demonstrate what happens when you attempt to read/write to something...
  25. Replies
    9
    Views
    1,948

    Re: Project Euler #14

    I suggested upgrading because I was under the impression that shadowx360 confused VC++ 9 with an older version.
    In fact, IIRC, this sort of "extension" was removed several years ago in an earlier...
Results 1 to 25 of 897
Page 1 of 36 1 2 3 4





Click Here to Expand Forum to Full Width

Featured