pmeerw's blog
Jun 2010
The BOSS challenge is up!
posted at: 22:40 | path: /academic | permanent link
GNU C++ already provides some features of the upcoming c++0x standard which really make programming more convenient...
// compile with g++ -Wall -std=c++0x newcpp.cpp
// taken from c't 2010/7
// see also http://gcc.gnu.org/projects/cxx0x.html
#include <vector>
#include <iostream>
#include <initializer_list>
#include <tuple>
struct X {
// initializer list
X(std::initializer_list<int> l) : data(new int[l.size()]) {
std::copy(l.begin(), l.end(), data);
}
// disable copy constructor
X(const X &o) = delete;
// make explicit that we use the default assignment operator
X& operator=(const X &o) = default;
int *data;
};
/* not yet
constexpr int f() {
return 42;
}
*/
int main() {
// initializer lists
std::vector<int> v = {1, 2, 3};
X x({1, 2, 3});
// auto type
for (auto i = v.begin(); i != v.end(); i++) {
std::cout << *i << std::endl;
}
/* not yet
for (const auto i : {1, 2, 3}) cout << i << endl;
*/
// enum with scope
enum class Color {Red, Green, Blue};
enum class Alert {Red, Yellow, Green};
// enum with explicit type
enum class Level : short {Low = 3, High = 8};
/* not yet
// null pointer
int *a = nullptr;
*/
// compile-time assert
static_assert(sizeof(int *) == 4, "32bit pointers expected");
// tuple (using variadic template parameters internally)
std::tuple<int, int, int> y{1, 2, 3};
}
posted at: 11:01 | path: /programming | permanent link
OpenURL COinS facilitates the import of bibliographic data shown on a web page in services such as CiteULike or Mendeley.
COinS is short for ContextObjects in Spans; it allows to embed bibliographic metadata in HTML.
OpenURL COinS metadata will soon be available on the wavelab publications page.
Here are links to my CiteULike and Mendeley accounts. Not sure if this online services scale to 6000+ bibliographic entries and 3+ GB of PDF I currently have...
posted at: 21:04 | path: /academic | permanent link