jason's blog

C++11: Decltype

decltype is a type specifier introduced in C++11. It behaves like a function that evaluates to the type of an object at compile time. This article is helping provide some more background information necessary for the more meatier C++11 articles to come.

decltype(4.23 * 5) v = 4.23*5;

In this example, the compiler is determining for us what the type of 4.23 * 5 would be and then giving that type to v.

With some help from typeid we can see that the type assigned by the compiler is double.

 

C++ Partial Specialization of Templates

In this article we are going to introduce the concept of C++ Template Partial Specialization. This is meant to be just a primer on the topic and not exhaustive. The examples here will be used and referenced in later articles. A series of discussions about C++11, now that the language has been finalized, will be coming shortly.

In C++ a template class such as this:

template<typename LHS, typename RHS>
struct Add_With_Magic
{
  static int go(const LHS &t_lhs, const RHS &t_rhs)
  {

Nobody Understands C++: Part 11: Including Me (aka, Provide Consistent Semantics)

I just spent the better part of the day debugging an insidious little bug. It really shouldn't have taken that long... I even had unit tests in place that covered the code in question! Right!?

The fact is, C++ is a complex language and getting every detail right all the time can be hard. In this case I had a simple class with a boost::shared_ptr in it. In the copy constructor I wanted to clone the pointed to object, but needed to keep the pointer for other house keeping reasons.

class MyClass
{
public:
  MyClass(const MyClass &t_other)

Retro Sierra Gaming

If you're a fan of retro gaming in general and Sierra adventure games specifically, like I am, you might appreciate the following. I purchased the Quest for Glory Anthology (I - IV) and Quest for Glory V around 1998, when they were new. The Quest for Glory series is one of the few adventure games with RPG elements which allows you to create a character in one game and carry it forward from game to game. For the past 12 years I've been intending to play start to finish through all 5 games.

Microsoft's Failing Support For C++

Microsoft recently posted a video on Channel 9 and their blogs describing the upcoming work they have planned for C++.

The abstract of the video tries to point out Microsoft's unfailing devotion to C++ development:

C++ AI FTW

Considering the number of articles and polls we come across asking if C++ is dying or dead combined with the decrease in C++ job posting I have personally noticed, C++ sure is alive and well in the AI frontier.

C++ takes or ties the top 27 places at the 2010 Google AI Challenge

Syndicate content