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

Search:

Type: Posts; User: JohnW@Wessex

Page 1 of 80 1 2 3 4

Search: Search took 0.09 seconds.

  1. Replies
    27
    Views
    2,192

    Re: Bool type problem

    I've worked on a DSP platform where there was no such thing as an 8 bit type.
  2. Re: Overloading std::distance for a specific iterator type

    Thanks, that makes sense.
  3. Overloading std::distance for a specific iterator type

    I have a templated container that defines a forward iterator.

    Calling std::distance on these iterators will generate code that will count the number of iterations it takes to get from the first...
  4. Replies
    27
    Views
    2,192

    Re: Bool type problem

    The result is also highly variable on the types used.
    (Visual Studio 2013)


    struct preferences {
    bool likesMusic : 1;
    bool hasHair : 1;
    bool hasInternet : 1;
    bool hasDinosaur : 1;
    unsigned...
  5. Replies
    48
    Views
    2,544

    Re: Is this guaranteed to be correct?

    :thumb:
  6. Replies
    11
    Views
    636

    Re: Templated upcast function

    class Base {};
    class NotBase {};
    class Derived1 : public Base {};
    class Derived2 : public Base {};


    Variant<Derived1, Derived2> values;


    Base& base = values; // Compile fail. Ambiguous...
  7. Replies
    11
    Views
    636

    Re: Templated upcast function

    But that generates a runtime error.
    With the Variant template class it's a compile time error.
  8. Replies
    11
    Views
    636

    Re: Templated upcast function

    The type checks are now all compile time. It was a fairly simple exercise in the end. :)



    Where are the downcasts? The only casts available to the user are upcasts and they are now all checked...
  9. Replies
    11
    Views
    636

    Re: Templated upcast function

    The class it's used in has a variable number of template types. The unused template types default to 'null type' place holders.
    If the check was at compile time then the placeholders fail the test....
  10. Replies
    11
    Views
    636

    Re: Templated upcast function

    Do'h!!
    I must have been a bit overtired when I wrote that bit :blush:
  11. Replies
    11
    Views
    636

    Re: Templated upcast function

    I think I'm close to a solution, but for a (for the moment) puzzling compiler error.


    template <typename TBase, typename T, const bool IsBase>
    struct DoIt;

    template <typename TBase,...
  12. Replies
    11
    Views
    636

    Templated upcast function

    I have a templated function that attempts to upcast a type to a specified base class.
    If TBase is a base of T then a simple upcast is performed.
    If TBase is not a base of T then an exception is...
  13. Replies
    48
    Views
    2,544

    Re: Is this guaranteed to be correct?

    Part of the my personal design brief for my Variant class was to reduce any type safety issues to an absolute minimum. In this I think I've been pretty much successful. The main way to get around...
  14. Replies
    48
    Views
    2,544

    Re: Is this guaranteed to be correct?

    That's an interesting idea, though I still have the niggling doubt in the back of my mind that there may be the possibility of getting more than one instance of Id() for a particular type. I could be...
  15. Replies
    48
    Views
    2,544

    Re: Is this guaranteed to be correct?

    That's actually very similar to what I already had, except that instead of a union I have a data area sized to the largest type (and aligned to a 32bit boundary)
    When a value is stored it uses a...
  16. Replies
    48
    Views
    2,544

    Re: Is this guaranteed to be correct?

    @superbonzo

    I had a chance to look at your suggestions this morning, and, like a lot of good ideas, its seems obvious once you know the solution.

    With a couple of minor changes it grafted in...
  17. Replies
    48
    Views
    2,544

    Re: Is this guaranteed to be correct?

    I've only had a chance to briefly skim your code so I probably misunderstood your method :blush:
  18. Replies
    48
    Views
    2,544

    Re: Is this guaranteed to be correct?

    I've just realised the small, but significant difficulty with that method.

    Any<int, double> any1 = 1;
    Any<double, int> any2 = 1;

    bool b = any1.IsSameTypeAs(any2); // This will return 'false'...
  19. Replies
    48
    Views
    2,544

    Re: Is this guaranteed to be correct?

    Thanks for that.:thumb:
    I'll give it a look over this evening to see if it can be grafted into what I already have.
  20. Replies
    48
    Views
    2,544

    Re: Is this guaranteed to be correct?

    Your example isn't solving the same problem as what I was describing.

    What I my class is designed to do is this.
    (Types in the template parameter list must be unique; no duplicates)



    int...
  21. Replies
    48
    Views
    2,544

    Re: Is this guaranteed to be correct?

    Actually the implementation has a lot of type safety. That was one of the goals I had in mind.

    I have static asserts that will ensure a compile error if an unsupported type is requested.

    int i;...
  22. Replies
    48
    Views
    2,544

    Re: Is this guaranteed to be correct?

    Possibly. It's not clear what is going on behind the scenes. If it's just using the hash_code and the generation of the type_info is at compilation time then that would have been a perfect...
  23. Replies
    48
    Views
    2,544

    Re: Is this guaranteed to be correct?

    That's fine.



    This is for an ARM based board with no OS, single threaded with a few interrupts, and a message passing cooperative scheduler.



    I couldn't find a way to use RTTI that didn't...
  24. Replies
    48
    Views
    2,544

    Re: Is this guaranteed to be correct?

    Thanks, that's good to hear.
    Our code is single threaded, though there are many interrupts.
    Thanks for reminding me about that. :thumb:
  25. Replies
    48
    Views
    2,544

    Re: Is this guaranteed to be correct?

    Some background to the problem.

    I'm experimenting with a class similar in some ways to Boost::any, but more resource and performance friendly to our embedded platform.

    It's implemented as a...
Results 1 to 25 of 2000
Page 1 of 80 1 2 3 4


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center