@CatPlusPlus Well, Scala syntax feels a bit less strange than Haskell if you're used to the classic imperative languages. What do you find confusing about it?
well, it can certainly lead to some useful scenarios
let's face it, you guys would kill me if I specced a new language where you had Standard.Algorithms.ForEach(Container.Begin(), Container.End(), function(Type x) {... });
Sometimes I get tired of all this my_vector.begin(), my_vector.end() noise. Last year at boostcon, Andrei Alexandrescu's keynote speech was titled Iterators Must Go (video)
Is there any progress on introducing ranges into C++, so I can finally say std::sort(my_vector)?
Does anyone know if I can target just directories in a Makefile? I want to make a target that matches multiple directories, like so dir/%:, but I want to make it skip files...
"but the template member function will not." I don't think that is true. The spec says that such members are instantiated too. It is just that many implementations (including modern ones like Clang) will not instantiate the member template definitions. That's a conforming deviation, because if the member template definition contained an error, the member template definition would be "ill-formed; no diagnostic required". For Clang, the reason they don't instantiate member template definitions is performance - they would need to typecheck a lot more then. — Johannes Schaub - litb3 mins ago
@FredOverflow In fact, I don't even have member typedefs. Or member constexprs or anything like that. You can introduce them if you want, but they don't exist by default.
@JohannesSchaublitb It doesn't. But the point I'm making is that if you tried to write one, you'd be quite fucked because all the Java Unicode APIs are tightly coupled to their String class.
@DeadMG I wonder, what more services do a string need to offer compared to a vector of characters ("character" being unicode code points in this case).
In computer programming a rope, or cord, is a data structure for efficiently storing and manipulating a very long string. For example, a text editing program may use a rope to represent the text being edited, so that operations such as insertion, deletion, and random access can be done efficiently.
Description
A rope is a binary tree in which each node has a weight. Leaf nodes (as well as some single-child internal nodes) also contain a short string. The weight of a node is equal to the length of its string plus the sum of all the weights in its left subtree. Thus a node with two child...
Where I work, we mostly do games with a freemium model, so we need an infrastructure to handle the microtransactions. Our engine is in C++, our tools in C#, and the servers all run Java.
Clojure (pronounced like "closure") is a recent dialect of the Lisp programming language created by Rich Hickey. It is a functional general-purpose language. Clojure time-handling constructs simplify multithreaded programming.
Clojure runs on the Java Virtual Machine, Common Language Runtime, and JavaScript engines. Like other Lisps, Clojure treats code as data and has a sophisticated macro system.
History
Rich Hickey is the creator of the Clojure programming language. Before Clojure, he developed dotLisp, a similar project based on the .NET platform. Hickey spent about 2½ years workin...
@Mysticial Depends. If your code is basically wanking all over templates then that might increase compilation times even if you had a noncrappy build system.
user784668
Interpreting a Turing-complete language isn't going to be fast anyway.
I read some study that C++ can achieve the best performance (out of the few languages the study uses) but requires a bit of tuning by the programmer to achieve that.
@Fanael A tiny performance penalty is fine. I don't mind the function call overhead between different modules. As long as all the tight loops are fully optimized it won't result in a 10x penalty.
You are the victim of branch prediction fail.
What is Branch Prediction?
Consider a railroad junction:
Image by Mecanismo, from Wikimedia Commons: http://commons.wikimedia.org/wiki/File:Entroncamento_do_Transpraia.JPG
Now for the sake of argument, suppose this is back in the 1800s - before...
> Intel Compiler 11 does something miraculous. It interchanges the two loops, thereby hoisting the unpredictable branch to the outer loop. So not only is it immune the mispredictions, it is also twice as fast as whatever VC++ and GCC can generate! In other words, ICC took advantage of the test-loop to defeat the benchmark...
@Fanael One way to pessimize it is with -fno-inline.
user784668
@Insilico It's not that much of a pessimization (they only take time to decode, not to execute, better to insert some nop-like movs and leas), and it'd be nice if compilers could do it automatically.
Here is a piece of code that shows some very peculiar performance. For some strange reason, sorting the data miraculously speeds up the code by almost 6x:
#include <algorithm>
#include <ctime>
#include <iostream>
int main()
{
// generate data
const unsigned arraySize =...