Search:
Type: Posts; User: JohnW@Wessex
Search:
Search took 0.09 seconds; generated 53 minute(s) ago.
-
July 29th, 2016, 03:16 AM
Does anyone know if there's a way to make this specialisation work?
I have a feeling that it is not possible to do what I want. Can anyone prove me wrong?
The previous incarnation of the original...
-
June 30th, 2015, 04:33 AM
If you are using a fixed length C array it can also be implemented in this way.
Where 'N' is the size of the array.
Be aware of course that each unique combination of T & N will create a another...
-
September 24th, 2014, 07:28 AM
I've worked on a DSP platform where there was no such thing as an 8 bit type.
-
September 24th, 2014, 07:16 AM
Thanks, that makes sense.
-
September 24th, 2014, 05:16 AM
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...
-
September 22nd, 2014, 09:22 AM
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...
-
September 10th, 2014, 03:09 AM
-
September 8th, 2014, 10:52 AM
class Base {};
class NotBase {};
class Derived1 : public Base {};
class Derived2 : public Base {};
Variant<Derived1, Derived2> values;
Base& base = values; // Compile fail. Ambiguous...
-
September 8th, 2014, 10:17 AM
But that generates a runtime error.
With the Variant template class it's a compile time error.
-
September 7th, 2014, 05:52 AM
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...
-
September 7th, 2014, 03:46 AM
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....
-
September 7th, 2014, 03:31 AM
Do'h!!
I must have been a bit overtired when I wrote that bit :blush:
-
September 6th, 2014, 07:24 AM
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,...
-
September 6th, 2014, 06:48 AM
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...
-
September 4th, 2014, 08:48 AM
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...
-
August 28th, 2014, 08:13 AM
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...
-
August 28th, 2014, 07:58 AM
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...
-
August 28th, 2014, 06:17 AM
@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...
-
August 27th, 2014, 11:10 AM
I've only had a chance to briefly skim your code so I probably misunderstood your method :blush:
-
August 27th, 2014, 10:27 AM
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'...
-
August 27th, 2014, 10:09 AM
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.
-
August 27th, 2014, 09:27 AM
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...
-
August 27th, 2014, 05:27 AM
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;...
-
August 27th, 2014, 03:27 AM
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...
-
August 26th, 2014, 11:15 AM
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...
|
Click Here to Expand Forum to Full Width
|