Jump to content

  • Log In with Google      Sign In   
  • Create Account

taliesinnz

Member Since 04 May 2009
Offline Last Active Jun 26 2014 06:24 PM

Topics I've Started

Decltype and template help

23 November 2010 - 09:59 PM

I am using MSVC2010 and getting a strange error



struct Foo;

template< typename T>
class Bar
{
}

template<>
class Bar< Foo >
{
int returnsomething()
{
return 1;
}
}

template< typename T>
auto getsomething() -> decltype( Bar< T >::returnsomething )
{
Bar< T > t;
return t.returnsomething();
}

main()
{
cout << getsomething< Foo >() << endl;
}

MSVC gives me an error C2893: Failed to specialize function template ''unknown-type'

I have read the help but not sure what it mean to my code.

Can someone enlighten me? Thanks

Task System Advice

19 February 2010 - 01:14 PM

Hey I'm currently working on a game in the early stages and I am having trouble deciding on how to design my task system. At the moment i just want to write a basic task system which if required one day I could easily implement multithreadded aspects to it. I have decided that the processing will be split into tasks ( Sound / AI / Graphics / Phsyics etc ). So if I have a character it will have a Update task, SOund task, graphics task, physics task. These tasks would be added and deleted when new characters are created or destroyed. I want to be able to sort them into a tree so I can process them in a logical order for example. Also I want each task to be able to spawn sub tasks for more processing, and to have various sorting strategies for the sub tasks ( FIFO, Front to Back, Back to Front, etc) in a node. Update Task Parent . Character 1 . Character 2 . Character 3 . Monster 1 . Monster 2 Draw Tasks . Draw Char 1 ... Physics ... At the moment tasks will be derived from a virtual class called Task which at the moment only has one method Update, but will add more as required. When it comes to processing I want it to run through the list calling any child processes in a continuous loop. If i decide to do a multi-thread game, each thread would go through and pick the next child off the list in order. I am having a hard time trying to choose a way of storing the task lists with their child elements and being able to quickly access the Task while looping through the whole list. And keeping everything sorted in the correct order. Any suggestions or experiences on the matter would be welcomed. PS I have heard of Intel TBB, and decided against using it.

PARTNERS