answersLogoWhite

0

In C++, extensibility relates to the way in which the language can be extended by adding new features using nothing more than the built-in features of the language itself, or by building upon the existing features found in the standard library or 3rd party libraries.

For instance, an array of int is a built-in data type, known as a C-style array because it was inherited from the C language. However, C-style arrays are difficult to work with because there's no built-in mechanism to determine an array's length. Even if we know the array's length in advance, in multi-threaded code it's all too easy for one thread to modify the length while another thread is operating upon the array, thus creating a race-condition where the pre-determined length no longer holds true for one of the threads which could lead to a (fatal) overflow.

However, C++ allows us to extend the capabilities of the language by creating new data types that can handle this type of problem gracefully. The new type simply needs to encapsulate a C-style array along with its size, treating the two as a single entity. Such a type already exists in the standard template library (STL); std::vector. However, a vector is not a built-in type, it is a completely new type. The STL is not part of the language itself -- it is just a library like any other -- but it provides a host of new types (mostly container types) that extend the language far beyond the capabilities of the built-in types, the majority of which came from C.

The STL types are general purpose; types that are common to the majority of everyday programmer needs, such as vectors, lists, queues, stacks, red/black trees and so on. However, programmer needs are many and varied, so while many of the STL types can be used as-is, there is often a need to specialise these types to suit a more specific task. Thus every new type you create extends the language further. And with a wealth of 3rd party libraries available, there is essentially no limit to the extensibility of the language. Indeed, the STL continues to evolve as a result of this extensibility, as does the language itself.

User Avatar

Wiki User

10y ago

What else can I help you with?