Search:

Type: Posts; User: drrngrvy

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    14
    Views
    2,079

    To exand what I said in the first post: ...

    To exand what I said in the first post:


    Header hdr;
    read( reinterpret_cast<u_char*>(hdr) );
    // Everything in it's right place now
    // use hdr here
    That means that the...
  2. Replies
    14
    Views
    2,079

    I thought that's exactly what reinterpret_cast...

    I thought that's exactly what reinterpret_cast does anyway?
  3. Replies
    14
    Views
    2,079

    I would have thought just having one type (ie....

    I would have thought just having one type (ie. u_char) would make padding a non-issue, but I'm not sure.



    No, but my question was more along the lines of: does having anything but a...
  4. Replies
    14
    Views
    2,079

    class layout guarantees

    Hi all,

    I'm wondering about the layout of a class, and what guarantees the standard (C++03) gives about class member layouts.

    For instance, if I have a class like:



    struct Header {
    ...
  5. Replies
    4
    Views
    4,029

    Ok, I've experimented a bit, but I'm still hazy...

    Ok, I've experimented a bit, but I'm still hazy on the correct way to do this. I'd appreciate some advice, as my searches have been mostly fruitless.

    template<typename T>
    struct traits
    {
    ...
  6. Finding a port associated with a file descriptor

    Hi all,

    I'm struggling to find information about how to map a file descriptor to port numbers. Something I'm working on requires the program to 'accept()' connections from the file descriptor...
  7. Replies
    4
    Views
    4,029

    Oops, of course. That wasn't the problem though....

    Oops, of course. That wasn't the problem though. I just got it working, but I can't say I understand why one works (Works) and not the other (Broken).



    template<typename Type>
    struct Traits
    {...
  8. Replies
    4
    Views
    4,029

    Using typedefs as friends

    Hi all,

    I'm having a problem using a typedef'd name in a friend class declaration. What I'm trying is variations on the following:




    struct Type
    {
    typedef OtherType other_type;
  9. In code, I'd do something like this: void f()...

    In code, I'd do something like this:

    void f()
    {
    tmpl_class<std::string> service; // std::string is just an example
    some_class handle(service);
    }
    I simply want some_class to work with any...
  10. templated members in non-template classes

    Given a class with a templated member:

    template<typename T> class tmpl_class {};

    class some_class
    {
    tmpl_class<T>& tmpl_member;
    public:
    template<typename T>
    some_class(...
  11. Boost::threads (http://www.boost.org/libs/thread)...

    Boost::threads is probably the best around though: you don't have every facility of pthreads, but it works on more platforms/compilers than anything else (I think).
  12. Isn't the point of the factory functions so you...

    Isn't the point of the factory functions so you can do something like:


    broken code = make_more_broken(42); // template arg of code automatically deduced

    Will that not work?
  13. I feared so. :( Thanks Noir.

    I feared so. :( Thanks Noir.
  14. Implicit template argument deduction for classes

    Hi all,

    I just discovered that class template arguements are never implicitly deduced from their constructor arguements. Am I correct in thinking that the following code won't work (as I don't...
  15. Replies
    11
    Views
    14,989

    std::vector vs. std::string

    I'm in a situation where I could save copying some memory if I could use a std::vector. The question is, what's the difference between, for instance, a std::vector<char> and a std::string? As far as...
  16. Replies
    8
    Views
    5,319

    Sorry about the late reply. The idea does go...

    Sorry about the late reply.

    The idea does go against seperation of code, but I prefer the idea of having a library that doesn't need to be linked with to work. It's more just for learning though....
  17. Replies
    7
    Views
    3,608

    Ok, thanks all for clearing that up. I found this...

    Ok, thanks all for clearing that up. I found this, which explains a lot. I was just trying to figure a way of getting boost.asio to accept from STDIN. I still haven't got it, but I'll keep looking....
  18. Replies
    7
    Views
    3,608

    Sorry, I meant network port. I'm aware that file...

    Sorry, I meant network port. I'm aware that file descriptors map back to anything else, but what about the other way around? What does 127.0.0.1:0 mean? It's port 0 on the loopback, but is that stdin...
  19. Replies
    7
    Views
    3,608

    File descriptors vs ports

    This is probably a painfully basic question, but these are usually the hard ones to google for. I know on linux that STDIN has a file descriptor of 0, but does that bear any relevance to the port...
  20. Replies
    3
    Views
    1,040

    You could just write to and read from the file in...

    You could just write to and read from the file in binary mode (set the std::ios::binary option when you open the file). Would that do?
  21. Replies
    8
    Views
    5,319

    Thanks for the reply, but what you're saying to...

    Thanks for the reply, but what you're saying to do is the only way I know to do that. The thing I'm wondering is how you implement the declaration of, in your example, Foo::s_value without having a...
  22. Replies
    8
    Views
    5,319

    Static variables and header files

    I was wondering if there's a way around having to declare static variables only once when writing classes which are just in header files. I didn't think it could be done, but looking around the boost...
  23. Replies
    3
    Views
    2,128

    Ah, ok. I was actually under the impression (for...

    Ah, ok. I was actually under the impression (for silly reasons, apparently) that it was the opposite of the global namespace. Oops. Thanks for the reply.
  24. Replies
    3
    Views
    2,128

    What does ::blah mean?

    Just a simple one (that's hard to search for answers to), basically just the title.

    What exactly happens when there isn't a namespace in front of the '::'? Is it to do with the current namespace?...
  25. Replies
    5
    Views
    1,259

    You should give the struct a constructor that...

    You should give the struct a constructor that initialises its members in an initialisation list, then use something like this:

    struct s
    {
    s( const int m1_, const int m2_ ) : m1(m1_) ,...
Results 1 to 25 of 88
Page 1 of 4 1 2 3 4