cpp11 branch - committing the merge (rest of it)

git-svn-id: svn://ultimatepp.org/upp/trunk@7048 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-03-16 16:35:29 +00:00
parent 51687976c2
commit e5dfeba4be
58 changed files with 1176 additions and 2335 deletions

View file

@ -21,22 +21,29 @@ struct Number {
virtual double Get() const = 0;
String ToString() const { return AsString(Get()); }
virtual ~Number() {}
};
struct Integer : public Number {
int n;
virtual double Get() const { return n; }
Integer(int n) : n(n) {}
Integer() {}
};
struct Double : public Number {
double n;
virtual double Get() const { return n; }
Double(double n) : n(n) {}
Double() {}
};
bool operator<(const Number& a, const Number& b)
{
return a.Get() < b.Get();
}
CONSOLE_APP_MAIN
{
VectorMap<String, Person> m;
@ -89,8 +96,8 @@ CONSOLE_APP_MAIN
DUMPC(ps);
ArrayMap<String, Number> am;
am.Add("A", new Integer(1));
am.Add("B", new Double(2.0));
am.Create<Integer>("A").n = 1;
am.Create<Double>("B").n = 2.1;
DUMPC(am.GetKeys());
DUMPC(am.GetValues());