I like mine better, but you get the same effect. I like mine better cause when I am helping my clients, it works with all scenario, no need for editing.
Code:
RewriteCond %{HTTP_HOST} !^(www\.|$) [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]