#include <Teuchos_Workspace.hpp>
Collaboration diagram for Teuchos::Workspace< T >:
Public Member Functions | |
| Workspace (WorkspaceStore *workspace_store, size_t num_elements, bool call_constructors=true) | |
| Allocates a num_elements array of temporary objects. | |
| ~Workspace () | |
The destructor on the elements will only be called if call_constructors == true was passed to the constructor. | |
| size_t | size () const |
| Return the number of elements in the array. | |
| T & | operator[] (size_t i) |
| Non-const zero based element access. | |
| const T & | operator[] (size_t i) const |
| Const zero based element access. | |
Objects of this type are what should be created by the user instead of RawWorkspace objects since this class will properly initialize memory using placement new and allows typed operator[] access to the array elements. The default constructor, copy constructor and assignment operations are not allowed and objects can not be allocated with new.
It is important to note that the constructors and destructors will only be called if call_constructors=true (the default) is passed to the consructor Workspace(). For build-in types that do not need constructors and destructors called, the client should pass in call_constructors=false . Otherwise we would have to call constructors and destructors on all of the memory and that could considerably slow things down.
With simple built-in data types (i.e. call_constructors=false) the cost of creating and destroying one of these objects should be O(1) independent of how much data is requested. This is true as long as no dynamic memory has to be allocated (this is determined the object workspace_store passed to the constructor Workspace()).
Definition at line 161 of file Teuchos_Workspace.hpp.
|
||||||||||||||||||||
|
Allocates a num_elements array of temporary objects.
Definition at line 324 of file Teuchos_Workspace.hpp. |
|
|||||||||
|
The destructor on the elements will only be called if
Definition at line 336 of file Teuchos_Workspace.hpp. |
|
|||||||||
|
Return the number of elements in the array.
Definition at line 348 of file Teuchos_Workspace.hpp. |
|
||||||||||
|
Non-const zero based element access. Preconditions:
Definition at line 355 of file Teuchos_Workspace.hpp. |
|
||||||||||
|
Const zero based element access. Preconditions:
Definition at line 365 of file Teuchos_Workspace.hpp. |
1.3.9.1