Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 23 Apr 2003
Offline Last Active Today, 08:58 AM

Topics I've Started

C++ virtual inheritance

13 October 2015 - 01:15 AM

A simple question regarding virtual inheritance in C++. Given the following inheritance hierarchy:

struct A {
	A();	// make calling this a compile time error
	A(int) {}

struct B : virtual public A {};

struct C : virtual public A, virtual public B {
	C() : A(5) {}

Is there any way to make calling A::A() a compile time error?  For example:

A a;     // error
B b;     // error
C c;     // valid 

Obviously I can throw a run-time error, but I'd prefer a compile time error.

C++ dynamic_cast

18 August 2015 - 07:23 AM

While looking around for a faster way to perform dynamic_cast's I came across this: https://github.com/DigitalInBlue/Priori.  The general idea came from a Stroustrup paper not too long ago where every base class is given a unique prime number id, and then a simple modulo operation can determine the legitimacy of a dynamic_cast.  Seemed simple enough but from my understanding of dynamic_cast is that pointer adjustments sometimes must be made as well.  At its core the code posted seems to simply use reinterpret_cast.

template<class T, class V> T priori_cast(V base) 
	if(base != nullptr)
		// If it is convertable to the base class or to itself, return
		if(std::is_convertible<std::remove_pointer<V>::type, std::remove_pointer<T>::type>::value == true)
			return reinterpret_cast<T>(base);

		const auto factor = priori::get(typeid(std::remove_pointer<T>::type));

		if((factor != 0) && (base->priori(factor) == true))
			return reinterpret_cast<T>(base);

	return nullptr; 

This doesn't seem kosher...  Any thoughts on this?

Unity Asset Store license

07 August 2015 - 05:28 PM

Simple question, if I purchase content from the Unity Asset store, can I use it in a non-Unity game?  I've read through the license (https://unity3d.com/legal/as_terms) and the following seemed to imply it was ok:
"Licensor grants to the END-USER a non-exclusive, worldwide, and perpetual license to the Asset to integrate Assets only as incorporated and embedded components of electronic games and interactive media and distribute such electronic game and interactive media."
That said I was wondering what other people thought?

Windows 10 is hideously ugly, any tips on how to fix?

29 July 2015 - 04:59 PM

Just upgraded from Windows 7 to 10... and this thing is ugly.  Does anyone know where to find a Windows 7 like theme?  Or some way to individually adjust colors/fonts.

Unity Asset Store problems

10 June 2015 - 10:57 AM

I tried to order a set of textures from the unity asset store for the first time the other day, only to have it reject two different credit cards. I called up VISA (one was VISA one Mastercard) and they said they saw the transaction, and it was accepted by them but canceled by the merchant. I tried sending Unity a 'sales inquiry' through their website but they haven't gotten back to me. Anyone else have a similar problem? Any ideas on how I would go about resolving it?