Welcome! This is where I write stuff...
På väg i taxi från Kista till Stockholms city till företagets årliga kräftskiva upptäckte vår ekonomichef att hon glömt skärpet på kontoret. Risk för pösiga byxor var överhängande vilket debatterades och lite olika förslag vad det glömda skärpet kunde användas till kastades fram under resan. Resan avslutade med den här limericken (fritt från minnet och kanske något redigerat ;-)
En blond ekonomichef från Kista En SM-klubb skulle bevista Men det blev ingen värk för hon glömde sitt skärp Så det smisket fick hon allt mista
List of all articles about C++0X or C++-11.
== Getting a tool chain to experiment with To experiment with the new C++ features it is good to have . . .
2K - last updated 2011-05-20 12:29 UTC by 220.127.116.11
= Auto is dead, long live auto The keyword auto will get a new meaning. The old meaning is something . . .
1K - last updated 2012-02-09 10:41 UTC by 18.104.22.168
As it happens I have had a long vacation and done other stuff than thinking about the new standard. That . . .
1K - last updated 2010-08-06 21:56 UTC by host-90-233-49-169.mobileonline.telia.com
OOPS! Other stuff came along and I have had to stop with learning more about the new features in C++. . . .
1K - last updated 2010-11-19 23:34 UTC by localhost.localdomain
=More on type inference Together with **auto** there is a new keyword **decltype**. It is used to determine . . .
1K - last updated 2011-06-17 15:23 UTC by 22.214.171.124
=Initializer lists How many times have you not wanted to easily initialize a container with a list of . . .
2K - last updated 2011-06-27 07:43 UTC by 126.96.36.199
=Taking initialization one step further - Uniform Initialization Initializing containers is fine but . . .
1K - last updated 2011-06-28 11:38 UTC by 188.8.131.52
=Range based for loops Looping over containers is a very common task so it should be easy two write and . . .
1K - last updated 2011-07-31 22:47 UTC by host-90-232-62-193.mobileonline.telia.com
= Lambda expressions For defining small functions at the very spot they are used C++ introduces lambda . . .
2K - last updated 2011-09-15 19:51 UTC by localhost.localdomain
=More on Lambdas As we saw in the example with computing the sum we could in the lambda bind a variable . . .
2K - last updated 2011-09-20 14:01 UTC by 184.108.40.206
=New keyword nullptr Maybe what can be called a smaller correction in the new standard is the introduction . . .
2K - last updated 2011-10-19 15:41 UTC by 220.127.116.11
=Getting multiple angle brackets right A mostly embarrassing thing with good old C++ was that multiple . . .
1K - last updated 2011-11-25 23:45 UTC by localhost.localdomain
= Object construction made easier There are three things made for easier object construction. Non static . . .
3K - last updated 2011-12-20 07:04 UTC by 18.104.22.168
= constexpr To allow more expressive constant expressions C++-11 introduces the keyword **constexpr**. . . .
2K - last updated 2012-02-08 16:44 UTC by 22.214.171.124
= Explicit virtual overrides There were some, small!?, problems regarding controlling derivation and . . .
1K - last updated 2012-02-09 10:46 UTC by 126.96.36.199
= Strongly typed enums The old enum definition was a bit lame. Enums were almost interchangeable with . . .
1K - last updated 2012-02-24 23:15 UTC by 1-1-4-2a.mal.sth.bostream.se
= Giving up on static linkage I've been struggling with getting the treading examples working but with . . .
2K - last updated 2012-02-27 21:55 UTC by 1-1-4-2a.mal.sth.bostream.se
2012-04-18 1 CPlusPlus11
=Move semantics Copying big objects has always been a problem and somethings that you want to avoid. . . .
2K - last updated 2012-04-18 16:06 UTC by 1-1-4-2a.mal.sth.bostream.se
Started to write under the label [[CPlusPlus11]] for the new C++11 stuff. So much time has passed since . . .
1K - last updated 2012-04-18 15:52 UTC by 1-1-4-2a.mal.sth.bostream.se
= Moving on Time to investigate the new move semantics, or at least what I have understood about it! . . .
2K - last updated 2012-05-08 05:42 UTC by 1-1-4-2a.mal.sth.bostream.se
= Changes to old habits - you need to move to! With moving available the old habit of always passing . . .
1K - last updated 2012-05-08 09:13 UTC by 1-1-4-2a.mal.sth.bostream.se
= Still moving on One obvious place for moving objects instead of copying is when making a swap. It is . . .
2K - last updated 2012-05-08 07:52 UTC by 1-1-4-2a.mal.sth.bostream.se
= The future of threading A major concern these days is how to handle all these cores we have available . . .
2K - last updated 2012-05-09 12:43 UTC by 1-1-4-2a.mal.sth.bostream.se
= Unrestricted Unions Unions is somewhat of a white area on the C++ map for me. I can't remember that . . .
1K - last updated 2012-05-11 21:55 UTC by 1-1-4-2a.mal.sth.bostream.se
= Raw String Literals A raw string is a character sequence where there are no special characters. What . . .
2K - last updated 2012-06-15 11:39 UTC by 1-1-4-2a.mal.sth.bostream.se
= Template-ized typedefs and template Aliases With C++11 we can define a typedef as a template using . . .
1K - last updated 2012-10-10 15:19 UTC by 188.8.131.52
= C++1y/C++14 Just when you have been starting to wonder when all these nice C++11 features are going . . .
1K - last updated 2013-04-29 06:57 UTC by setnip01.ericsson.net
Nytt rim efter en längre tids uppehåll i rimmandet. Har haft lite svårt att ta mig tid till att sitta ner och fundera. Hur som helst här är JulRimSD.
Många undrade när fortsättningen kommer och det får vi väl se helt enkelt!
With C++11 we can define a typedef as a template using the keyword using. Suppose you have a type with the template type parameter T and the template int parameter size. Now typedefs can't be templates but with the new using syntax the type can be defined like this:
template<typename T, int size> using TheType = array<T, size>;
Achieving the same result as typedef. Now we have a type, TheType?, that is a template type.
It does not end there. We can further partially bind a template using the same syntax. So if we would like to define a new type based on TheType? but with the size bound to 10 we would do like this:
template <typename T> using SizeTen = TheType<T, 10>;
This is an example on how to set the fonts in XEmacs under Windows.
(when (memq (device-type) '(mswindows)) (set-face-font 'default "Courier New:Regular:8::") (set-face-font 'buffers-tab "Courier New:Bold:8::") (set-face-font 'bold "Courier New:Bold:8::") (set-face-font 'italic "Courier New:Italic:8::"))
Since a few days now we have a new build slave for the xemacs buildbot. It is an iMac: "Mac OSX 10.6.8, iMac 3.06 GHz Intel Core i3". Thanks Raymond Toy for providing this resource.
This is not really an XEmacs thing but hit me when I tried to get gnus working with XEmacs under cygwin. It seems you need to install the openssl development package under cygwin to get the openssl command line tool. That took me some time to figure out.
Connecting to an imap server using the same setup as under Linux produced no error message about the openssl tool missing. I just got an unhelpful connection denied form gnus. That error message fooled me into a bunch of other possible error causes before I understood that it was just that the tool openssl that was missing.
A raw string is a character sequence where there are no special characters. What you see is what you get. This makes it much easier to defined a string that contains a character sequence that would be interpreted as a special char if a normal string would have been used. Sequences like \n, \t, \b etc needs special treatment if not to be interpreted as special characters.
The syntax in its most straight forward form is this:
R for raw and "( and )" as starting and ending sequence allowing characters between be just what they are. Here are some examples of raw strings:
R"(hello "world")" -> hello "world" R"(no newline \n or tab \t)" -> no newline \n or tab \t R"( Multiline "string" is just as it is typed )" -> Multiline "string" is just as it is typed
As seen in the last example you can easily define large multilined text this way.
Another situation where raw strings pay off is when there are lots of chars that normally needs to be escaped. This is the situation with regular expressions where the back slash character, \, is used either to give or remove special meaning to characters. So in regular expressions defined by normal strings the back slash character itself needs to be escaped. We don't need all this extra escaping when using raw strings.
Regexp support isn't in gcc yet so I'll come back with examples later.
To complete the definition of raw strings. What if you need the terminating sequence )" in your raw string? The general definition of a raw string, which allows you to specify a delimiter sequence, solves this:
Where delimiter is an up to 16 char sequence with no whitespace. So you can write like this using # as delimeter:
R"#(')"')#" -> ')"'