[rosedu-general] C++ la CDL (Was: [CDL] Prezentări)

Adrian Scoica adrian.scoica at gmail.com
Wed Aug 10 11:45:12 EEST 2011


2011/8/10 Mihnea Dobrescu-Balaur <mihneadb at gmail.com>:
> 2011/8/9 Adrian Scoica <adrian.scoica at gmail.com>:
>> 2011/8/9 Andrei Maruseac <andrei.maruseac at gmail.com>:
>>>> Eu sunt pentru Python. [...]
>>
>>> Datorită experienţei mele de la CDL, sunt tot pentru Python. [...]
>>
>> Fine, if that's what people want... Python it is.
>>
>> Iata cum as rezuma eu... std::map<std::string, void*> :))
>
> dict() ftw! :)

Daca tot suntem aici... putem sa implementam automat si garbage
collection pe lanturi neciclice de referinte, corect este:

#ifndef __PYTHONSYNTAX_H__
#define __PYTHONSYNTAX_H__

#pragma once

namespace pysyn {
typedef boost::shared_ptr<Object*> Value;
typedef std::string Key;
class Object { public: virtual ~Object() = 0; };
typedef std::map<std::string, boost::shared_ptr<Object*> > Dictionary;
}

#endif

There... include that and you have Python syntax... :). Doar ca in
C++, e considerat bad practice din cel putin doua motive: weak typing
si virtualisation overhead ;).

Disclaimer: this is not trolling!


More information about the rosedu-general mailing list