Atom Atom feed

New Language Features Galore

Just as Java's new language features buzz is dying down (reified generics no longer being mentioned, etc.) the C++0x standards is nearing completion.

In today's OCI internal C++ lunch, Adam Mitz (who apparently needs a more updated homepage) talked about the new C++ language features that may become available in the updated standard. We've covered the new library features in a previous C++ lunch.

Here's some of the more interesting features.

Raw strings

R"$
A string that may contain embedded
new line characters.
$"

Lambdas

<>(int x, int y) -> int {return x + y; }

Closures

std::cout& os = ...;
setCallback(<>(int i) extern(os) { os << i; });

RValue References

A&& r = getA();

Variadic Templates

template <class... Elements> class tuple;

Alternative syntax for typedef

using callback = void (*)(void*, int);

Type inference

auto pi = 3.1415926535;
const auto& v = map["key"];

Concepts

template <LessThanComparable T> class ...;
auto concept LessThanComparable
<typename T> { bool operator<(T, T); };

Range based for loop

for (int i: vector_of_ints) {
  std::cout << i;
}

String enums

enum class E : unsigned long long {A, B, C};

And the quote of the day came when Adam answered the question "is this a hack?" with

It's all a hack, but so is the whole language.

For detailed information, Adam points us to JTC1/SC22/WG21 - The C++ Standards Committee Home Page.

Tags :

SUNW Is Now JAVA

I was off the internet for a couple of days and missed this announcement from Sun:

Jonathan Schwarz: And so next week, we're going to embrace that reality by changing our trading symbol, from SUNW to JAVA.

Shouldn't it read "Java technology-based ticker symbol"?

:)

Tags :