| dbpprop:abstract
|
- In computer science, a smart pointer is an abstract data type that simulates a pointer while providing additional features, such as automatic garbage collection or bounds checking. These additional features are intended to reduce bugs caused by the misuse of pointers while retaining efficiency. Smart pointers typically keep track of the objects that point to them for the purpose of memory management. The misuse of pointers is a major source of bugs: the constant allocation, deallocation and referencing that must be performed by a program written using pointers introduces the risk that memory leaks will occur. Smart pointers try to prevent memory leaks by making the resource deallocation automatic: when the pointer to an object (or the last in a series of pointers) is destroyed, for example because it goes out of scope, the pointed object is destroyed too. Several types of smart pointers exist. Some work with reference counting, others assigning ownership of the object to a single pointer. If the language supports automatic garbage collection (for instance, Java), then this use of a smart pointer is unnecessary. In C++ language, smart pointers may be implemented as a template class that mimics, by means of operator overloading, the behaviour of traditional (raw) pointers, while providing additional memory management algorithms. Smart pointers can facilitate intentional programming by expressing the use of a pointer in the type itself. For example, if a C++ function returns a pointer, there is no way to know whether the caller should delete the memory pointed to when the caller is finished with the information. some_type* ambiguous_function; // What should be done with the result? Traditionally, this has been solved with comments, but this can be error-prone. By returning a C++ auto_ptr, auto_ptr<some_type> obvious_function1; the function makes explicit that the caller will take ownership of the result, and further more, that if the caller does nothing, no memory will be leaked. Similarly, if the intention is to return a pointer to an object managed elsewhere, the function could return by reference: some_type& obvious_function2;
- Intelligente Zeiger oder Smartpointer werden in vielen gängigen Programmiersprachen wie etwa C++ verwendet. Es handelt sich um spezielle Zeiger, die gegenüber einfachen Zeigervariablen mit zusätzlichen Funktionen und Eigenschaften ausgestattet sind. Intelligente Zeiger erweitern also einfache Zeiger und statten sie mit mehr Funktionalität aus, lassen sich aber wie normale Zeigervariablen benutzen.
- Smart pointer (chytrý ukazatel) je abstraktní datový typ, který poskytuje funkčnost ukazatele, kterou ovšem rozšiřuje o další schopnosti, typicky řízení doby života (automatické uvolňování paměti, garbage collection), zajištění synchronizace při vícevláknovém programování apod. Klasické ukazatele mají mnoho nepohodlných vlastností a jejich správné užívání je relativně obtížné; často jsou proto zdrojem programátorských chyb. Smart pointery programátora od některých aspektů práce s ukazateli odstiňují a zjednodušují tak jejich používání. Nejběžnějším příkladem chyby při práci s ukazatelem je jeho neuvolnění, kvůli kterému dochází k tzv. úniku paměti (memory leak). Smart pointer se o toto uvolnění stará sám automaticky, zpravidla v okamžiku, kdy smart pointeru končí jeho doba života (k čemuž typicky dojde na konci rozsahu platnosti příslušné proměnné). V jazycích, které používají automatickou správu paměti pomocí garbage collection, se obvykle smart pointery nepoužívají.
- Sprytny wskaźnik (ang. smart pointer) to abstrakcyjny typ danych symulujący wskaźnik, dodając przy tym nowe funkcje takie jak odśmiecanie albo sprawdzanie zakresów odwołań (bounds checking). Niektóre sprytne wskaźniki wykonują reference counting, inne przekazują własność nad obiektem tylko jednemu wskaźnikowi. W przypadku języków z automatycznym odśmiecaniem użycie sprytnych wskaźników jest niepotrzebne. W języku C++ sprytne wskaźniki mogą zostać zaimplementowane jako wzorzec klasy, który dzięki przeładowaniu operatorów, udaje działanie zwykłego wskaźnika (dereferencja, przypisanie), dodając dodatkowe algorytmy zarządzania pamięcią.
- Em ciência da computação, um ponteiro inteligente (também conhecido pelo termo em língua inglesa smart pointer) é um tipo de dado abstrato que simula um ponteiro. Ele fornece mais funcionalidades que ponteiros, como coletor de lixo ou verificação de limites do tipo de dado, para adicionar segurança e reduzir erros de programação, ainda que maximizando a eficiência. Implementações de ponteiros inteligentes geralmente possuem referência aos objetos que apontam por questões de gerenciamento de memória. Do ponto de vista de padrões de projeto de software, um ponteiro inteligente é um proxy para uma interface de ponteiro.
- Умный указатель — класс, имитирующий интерфейс обычного указателя и добавляющий некую новую функциональность, например проверку границ при доступе или очистку памяти.
|
| rdfs:comment
|
- In computer science, a smart pointer is an abstract data type that simulates a pointer while providing additional features, such as automatic garbage collection or bounds checking. These additional features are intended to reduce bugs caused by the misuse of pointers while retaining efficiency. Smart pointers typically keep track of the objects that point to them for the purpose of memory management.
- Intelligente Zeiger oder Smartpointer werden in vielen gängigen Programmiersprachen wie etwa C++ verwendet. Es handelt sich um spezielle Zeiger, die gegenüber einfachen Zeigervariablen mit zusätzlichen Funktionen und Eigenschaften ausgestattet sind. Intelligente Zeiger erweitern also einfache Zeiger und statten sie mit mehr Funktionalität aus, lassen sich aber wie normale Zeigervariablen benutzen.
- Smart pointer (chytrý ukazatel) je abstraktní datový typ, který poskytuje funkčnost ukazatele, kterou ovšem rozšiřuje o další schopnosti, typicky řízení doby života (automatické uvolňování paměti, garbage collection), zajištění synchronizace při vícevláknovém programování apod. Klasické ukazatele mají mnoho nepohodlných vlastností a jejich správné užívání je relativně obtížné; často jsou proto zdrojem programátorských chyb.
- Sprytny wskaźnik (ang. smart pointer) to abstrakcyjny typ danych symulujący wskaźnik, dodając przy tym nowe funkcje takie jak odśmiecanie albo sprawdzanie zakresów odwołań (bounds checking). Niektóre sprytne wskaźniki wykonują reference counting, inne przekazują własność nad obiektem tylko jednemu wskaźnikowi. W przypadku języków z automatycznym odśmiecaniem użycie sprytnych wskaźników jest niepotrzebne.
- Em ciência da computação, um ponteiro inteligente (também conhecido pelo termo em língua inglesa smart pointer) é um tipo de dado abstrato que simula um ponteiro. Ele fornece mais funcionalidades que ponteiros, como coletor de lixo ou verificação de limites do tipo de dado, para adicionar segurança e reduzir erros de programação, ainda que maximizando a eficiência.
- Умный указатель — класс, имитирующий интерфейс обычного указателя и добавляющий некую новую функциональность, например проверку границ при доступе или очистку памяти.
|