<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Channel 9 Forums - Tech Off - New C++ runtime library</title>
	<atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/Forums/rss"></atom:link>
	<image>
		<url>http://mschnlnine.vo.llnwd.net/d1/Dev/App_Themes/C9/images/feedimage.png</url>
		<title>Channel 9 Forums - Tech Off - New C++ runtime library</title>
		<link>http://channel9.msdn.com/Forums</link>
	</image>
	<description>Channel 9 keeps you up to date with the latest news and behind the scenes info from Microsoft that developers love to keep up with. From LINQ to SilverLight – Watch videos and hear about all the cool technologies coming and the people behind them.</description>
	<link>http://channel9.msdn.com/Forums</link>
	<language>en</language>
	<pubDate>Wed, 22 May 2013 22:21:06 GMT</pubDate>
	<lastBuildDate>Wed, 22 May 2013 22:21:06 GMT</lastBuildDate>
	<generator>Rev9</generator>
	<c9:totalResults>10</c9:totalResults>
	<c9:pageCount>-10</c9:pageCount>
	<c9:pageSize>-1</c9:pageSize>
	<item>
		<title>Tech Off - New C++ runtime library</title>
		<description><![CDATA[<p>I am working on a library for C&#43;&#43; which is small, has no dependencies other than itself (i'm not using boost), works on all platforms, and most importantly is as friendly as C#.</p><p>This morning I finished testing my C&#43;&#43; implementation of linq. Here is an example of what it looks like. Your feedback is appreciated:</p><p>Edit: I expanded the examples</p><p><pre class="brush: cpp">// Enumerable queries in C&#43;&#43;
// This program searches the current directory
// And selects results using expression nodes

#include &lt;Codebot/Packages/System.h&gt;
#include &lt;Codebot/Packages/Expressions.h&gt;

using namespace Codebot;
using namespace Codebot::IO;
using namespace Codebot::Text;
using namespace Codebot::Expressions;

void TestFileFind()
{
  String SearchPath = &quot;*&quot;;
  if (Application::Args().Length() &gt; 0)
    SearchPath = Application::Args()[0];
  FileFind find;
  find.Search(SearchPath);
  auto query = Query(find)
    .OrderBy([] (FileResult a, FileResult b)
    {
      if (a.Attributes.Contains(FileAttribute::Directory))
      {
        if (b.Attributes.Contains(FileAttribute::Directory))
          return a.Name &lt; b.Name;
        return true;
      }
      if (b.Attributes.Contains(FileAttribute::Directory))
        return false;
      return a.Name &lt; b.Name;
    });
  ForEach(item, query)
    WriteLine(item.ToString());
  auto bytes = query
    .Select&lt;int&gt;([] (FileResult a) { return a.Size; })
    .Sum();
  WriteLine(&quot;{0|-31} total bytes\n&quot;, bytes);
}

void TestNumbers()
{
  Array&lt;int&gt; numbers = {7, 4, 2, 8, 3, 6};
  auto q = Query(numbers);
  WriteLine(&quot;The first value is {0}&quot;,
    q.FirstOrDefault());
  WriteLine(&quot;The count value is {0}&quot;,
    q.Count());
  WriteLine(&quot;The sum value is {0}&quot;,
    q.Where([] (int i) { return IsOdd(i); }).Sum());
  WriteLine(&quot;The average value is {0}&quot;,
    q.Average());
  WriteLine(&quot;The min value is {0}&quot;,
    q.Min());
  WriteLine(&quot;The max value is {0}&quot;,
    q.Max());
  q = q.Where([] (int i) { return i &gt; 2 &amp;&amp; i &lt; 8; })
    .OrderBy([] (int a, int b) { return a &gt; b; });
  WriteLine(&quot;List: {0:list}\n&quot;, q);
}

void TestStrings()
{
  Array&lt;String&gt; names = {&quot;John&quot;, &quot;Terrance&quot;, &quot;Ralph&quot;, &quot;Carl&quot;, &quot;Stanley&quot;};
  auto q = Query(names);
  WriteLine(&quot;The first value is {0}&quot;,
    q.FirstOrDefault());
  WriteLine(&quot;There are {0} items&quot;,
    q.Count());
  WriteLine(&quot;The sum is {0}&quot;, q
    .Where([] (String s) { return s.Contains(&quot;a&quot;); }).Sum());
  WriteLine(&quot;The minimum value is {0}&quot;,
    q.Min());
  WriteLine(&quot;The maximum value is {0}&quot;,
    q.Max());
  q = q.Where([] (String s) { return s &gt; &quot;Mary&quot;; })
    .OrderBy([] (String a, String b) { return a.Length() &lt; b.Length(); });
  WriteLine(&quot;List: {0:list}\n&quot;, q);
}

int main()
{
  return Application::Run({TestFileFind, TestNumbers, TestStrings});
}


/*
Output:

.                           Dir
..                          Dir
Debug                       Dir
.cproject                 14030  2012-04-12 14:41:33
.project                   2508  2012-04-14 08:20:42
Person.h                   1726  2012-04-12 22:59:28
Widget.cpp                  871  2012-04-12 01:34:43
Widget.h                   1663  2012-04-12 22:59:36
main.cpp                   2415  2012-04-15 20:32:45
                          23213 total bytes

The first value is 7
The count value is 6
The sum value is 10
The average value is 5
The min value is 2
The max value is 8
List: {7, 6, 4, 3}

The first value is John
There are 5 items
The sum is TerranceRalphCarlStanley
The minimum value is Carl
The maximum value is Terrance
List: {Ralph, Stanley, Terrance}

*/</pre></p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/New-C-runtime-library/3a373832165b4c08becca0330123a4fd#3a373832165b4c08becca0330123a4fd</link>
		<pubDate>Sat, 14 Apr 2012 17:41:50 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/New-C-runtime-library/3a373832165b4c08becca0330123a4fd#3a373832165b4c08becca0330123a4fd</guid>
		<dc:creator>sysrpl</dc:creator>
		<slash:comments>10</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/sysrpl/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - New C++ runtime library</title>
		<description><![CDATA[<p></p><blockquote><div class="quoteText"><p></p><p><a class="permalink" title="Post Permalink" href="/Forums/TechOff/New-C-runtime-library/3a373832165b4c08becca0330123a4fd">7 hours&nbsp;ago</a>, <a href="/Niners/sysrpl">sysrpl</a> wrote</p><p><span>ForEach(item, items)</span></p><div class="syntaxhighlighterHolder">&nbsp;</div><p></p></div></blockquote><p></p><p>&nbsp;</p><p>Why do you have your own ForEach function, and not using st::for_each, or a range based for loop? &nbsp;I'm guessing it's because the collections your linq operators return don't have&nbsp;iterators, and thus are not compatible with the Standard Template Library. &nbsp;Doing that is the very opposite of being friendly since you've&nbsp;eliminated&nbsp;a good portion of standard C&#43;&#43;.</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/New-C-runtime-library/d73c6d1d281d448db33fa034001c8658#d73c6d1d281d448db33fa034001c8658</link>
		<pubDate>Sun, 15 Apr 2012 01:43:51 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/New-C-runtime-library/d73c6d1d281d448db33fa034001c8658#d73c6d1d281d448db33fa034001c8658</guid>
		<dc:creator>c.str</dc:creator>
		<slash:comments>10</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/c_str/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - New C++ runtime library</title>
		<description><![CDATA[<p>@<a href="/Forums/TechOff/New-C-runtime-library#cd73c6d1d281d448db33fa034001c8658">c_str</a>:</p><p>I am trying to create idioms whereby when code is written with my library it feels like a higher level language.</p><p><pre class="brush: cpp">int i = 0; std::for_each(nums.begin(), nums.end(), [&amp;](int&amp; n){  i &#43;= n; });

// versus

int i = 0; ForEach(n, nums) i &#43;= n; 

// or simply

auto i = Query(nums).Sum();</pre></p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/New-C-runtime-library/153eba33ac534a14b5b2a034003d8efb#153eba33ac534a14b5b2a034003d8efb</link>
		<pubDate>Sun, 15 Apr 2012 03:44:07 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/New-C-runtime-library/153eba33ac534a14b5b2a034003d8efb#153eba33ac534a14b5b2a034003d8efb</guid>
		<dc:creator>sysrpl</dc:creator>
		<slash:comments>10</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/sysrpl/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - New C++ runtime library</title>
		<description><![CDATA[<p>again Why? What&nbsp;benefit&nbsp;does your&nbsp;library&nbsp;get from &quot;feeling like a higher level language&quot; ? &nbsp; and no &nbsp;feeling like a higher level language, is not a&nbsp;benefit&nbsp;since, it amounts to telling developers that in order to use your&nbsp;library&nbsp;they need to learn a new language. &nbsp; &nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/New-C-runtime-library/84e2ac9dda6240d2a7d0a034014a432b#84e2ac9dda6240d2a7d0a034014a432b</link>
		<pubDate>Sun, 15 Apr 2012 20:02:26 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/New-C-runtime-library/84e2ac9dda6240d2a7d0a034014a432b#84e2ac9dda6240d2a7d0a034014a432b</guid>
		<dc:creator>c.str</dc:creator>
		<slash:comments>10</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/c_str/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - New C++ runtime library</title>
		<description><![CDATA[<p>@<a href="/Forums/TechOff/New-C-runtime-library#c84e2ac9dda6240d2a7d0a034014a432b">c_str</a>: /ignore</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/New-C-runtime-library/37a9a81276574cbd8527a03500204e70#37a9a81276574cbd8527a03500204e70</link>
		<pubDate>Mon, 16 Apr 2012 01:57:37 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/New-C-runtime-library/37a9a81276574cbd8527a03500204e70#37a9a81276574cbd8527a03500204e70</guid>
		<dc:creator>sysrpl</dc:creator>
		<slash:comments>10</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/sysrpl/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - New C++ runtime library</title>
		<description><![CDATA[<p>Since LINQ is a library of functions (incase of .net utilising IEnumerable and IEnumerator).</p><p>How is different to learn a new library?&nbsp;@c_str&nbsp;</p><p>&nbsp;C and C&#43;&#43; is full of libraries developers have the potental to learn.&nbsp;</p><p>From a&nbsp;maintainability standpoint, the last two example @syspri provides are much simpler.</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/New-C-runtime-library/3c48af3265394183b9d4a035002de572#3c48af3265394183b9d4a035002de572</link>
		<pubDate>Mon, 16 Apr 2012 02:47:06 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/New-C-runtime-library/3c48af3265394183b9d4a035002de572#3c48af3265394183b9d4a035002de572</guid>
		<dc:creator>Adam Speight</dc:creator>
		<slash:comments>10</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/AdamSpeight2008/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - New C++ runtime library</title>
		<description><![CDATA[<p><span>@<a href="http://channel9.msdn.com/Niners/sysrpl">sysrpl</a> /ignore &lt;- see easy</span></p><p></p><blockquote><div class="quoteText"><p></p><p><a class="permalink" title="Post Permalink" href="/Forums/TechOff/New-C-runtime-library/3c48af3265394183b9d4a035002de572">1 hour&nbsp;ago</a>, <a href="/Niners/AdamSpeight2008">AdamSpeight2008</a> wrote</p><p>Since LINQ is a library of functions (incase of .net utilising IEnumerable and IEnumerator).</p><p></p></div></blockquote><p></p><p>Right, linq for .net utilizes&nbsp;what &nbsp;already existed in .net. &nbsp;Your point?&nbsp;</p><p></p><blockquote><div class="quoteText"><p></p><p>How is different to learn a new library?&nbsp;@c_str&nbsp;</p><p>&nbsp;C and C&#43;&#43; is full of libraries developers have the potental to learn.&nbsp;</p><p></p></div></blockquote><p></p><p>Do you mean difficult? &nbsp; It really depends on the library. &nbsp;</p><p>For example the multiple&nbsp;libraries&nbsp; for C&#43;&#43; that&nbsp;support&nbsp;LINQ &nbsp;that are&nbsp;compliment&nbsp;with the STL.</p><p>&nbsp;</p><p>&nbsp;</p><p></p><blockquote><div class="quoteText"><p></p><p>From a&nbsp;maintainability standpoint, the last two example @syspri provides are much simpler.</p><p></p></div></blockquote><p></p><p>Really? &nbsp;</p><p>auto complete is going to work?&nbsp;</p><p>Effectively&nbsp;throwing away most of a language is going to help improve&nbsp;maintainability?</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/New-C-runtime-library/91d9c1ead1564170ab97a0350055b207#91d9c1ead1564170ab97a0350055b207</link>
		<pubDate>Mon, 16 Apr 2012 05:12:00 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/New-C-runtime-library/91d9c1ead1564170ab97a0350055b207#91d9c1ead1564170ab97a0350055b207</guid>
		<dc:creator>c.str</dc:creator>
		<slash:comments>10</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/c_str/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - New C++ runtime library</title>
		<description><![CDATA[<p></p><blockquote><div class="quoteText"><p></p><p><a class="permalink" title="Post Permalink" href="/Forums/TechOff/New-C-runtime-library/3a373832165b4c08becca0330123a4fd">1 day&nbsp;ago</a>, <a href="/Niners/sysrpl">sysrpl</a> wrote</p><p>I am working on a library for C&#43;&#43; which is small, has no dependencies other than itself (i'm not using boost), works on all platforms, and most importantly is as friendly as C#.</p></div></blockquote><p></p><p>Out of curiosity, how do you deal with unicode? This is always the thing that trips me up when trying to write cross-platform C&#43;&#43; code. On Windows, you must use wchar_t; using char is simply not an option. On Linux, wchar_t is very wasteful (4 bytes), unnecessary because char supports utf-8, and syscalls don't accept wchar_t string arguments. However, a lot of the&nbsp;std library&nbsp;string manipulation stuff doesn't actually work with multi-byte strings of char.</p><p>The only way I've found to handle this is to take dependencies&nbsp;on things like ICU, which are rather big (~10MB).</p><p>EDIT: On a sidenote, how does WriteLine work? It's either not typesafe (very, very bad) or your library only supports compilers with support for variadic templates (not very many at the moment).</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/New-C-runtime-library/65c692b678bc4179ad08a03500851b05#65c692b678bc4179ad08a03500851b05</link>
		<pubDate>Mon, 16 Apr 2012 08:04:37 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/New-C-runtime-library/65c692b678bc4179ad08a03500851b05#65c692b678bc4179ad08a03500851b05</guid>
		<dc:creator>Sven Groot</dc:creator>
		<slash:comments>10</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/Sven Groot/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - New C++ runtime library</title>
		<description><![CDATA[<p>@<a href="/Forums/TechOff/New-C-runtime-library#c65c692b678bc4179ad08a03500851b05">Sven Groot</a>: I've wrtten my own string class which stores strings as reference couted unicode strings. It has constructors to handle a few different string types, and as you know with c&#43;&#43; this allows you to construct an object with a simple assignment.</p><p>Regarding WriteLine(), it is type safe, but I had to resort to writing many templated overloads</p><p><pre class="brush: cpp">WriteLine(const String&amp; s);

template &lt;typename A0&gt;
WriteLine(const String&amp; s, const A0&amp; a0) {}

template &lt;typename A0, typename A1&gt;
WriteLine(const String&amp; s, const A0&amp; a0, const A1&amp; a1) {}
</pre></p><p>Etc ... I also did the same thing with my Format() function. There is a single object&nbsp;hierarchy structure to my classes with the root being class ValueType. ValueType provides a ToFormat(const String&amp;) method which allows customization of how classes can be formatted.</p><p>When you say Format(&quot;Hello {0:base64}&quot;, memoryBuffer), the Format() function parses out &quot;base64&quot; from the 0th argument and passes that to a0.ToFormat(format) ... where format holds the value &quot;base64&quot;.</p><p>In this way any class can provide it's own formatting by simply override ToFormat(). For the default types like int, bool, double, etc I provide default formatters, eg: Format(&quot;{0:$#.##|-20}&quot;, dollarsAmount). Might return:&nbsp;&quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $150.00&quot;</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/New-C-runtime-library/2a1ebdac8cc74ff1a161a035010fb475#2a1ebdac8cc74ff1a161a035010fb475</link>
		<pubDate>Mon, 16 Apr 2012 16:29:14 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/New-C-runtime-library/2a1ebdac8cc74ff1a161a035010fb475#2a1ebdac8cc74ff1a161a035010fb475</guid>
		<dc:creator>sysrpl</dc:creator>
		<slash:comments>10</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/sysrpl/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - New C++ runtime library</title>
		<description><![CDATA[<p></p><blockquote><div class="quoteText"><p></p><p><a class="permalink" title="Post Permalink" href="/Forums/TechOff/New-C-runtime-library/2a1ebdac8cc74ff1a161a035010fb475">14 hours&nbsp;ago</a>, <a href="/Niners/sysrpl">sysrpl</a> wrote</p><p>@<a href="/Forums/TechOff/New-C-runtime-library#c65c692b678bc4179ad08a03500851b05">Sven Groot</a>: I've wrtten my own string class which stores strings as reference couted unicode strings. It has constructors to handle a few different string types, and as you know with c&#43;&#43; this allows you to construct an object with a simple assignment.</p></div></blockquote><p></p><p>That doesn't really answer my question. How are you storing the unicode strings? Which character type and which encoding? How are you handling conversions?</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/New-C-runtime-library/0f95c4ea0d4a4e61a09ea0360079fbca#0f95c4ea0d4a4e61a09ea0360079fbca</link>
		<pubDate>Tue, 17 Apr 2012 07:24:07 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/New-C-runtime-library/0f95c4ea0d4a4e61a09ea0360079fbca#0f95c4ea0d4a4e61a09ea0360079fbca</guid>
		<dc:creator>Sven Groot</dc:creator>
		<slash:comments>10</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/Sven Groot/Discussions/RSS</wfw:commentRss>
	</item>
</channel>
</rss>