bpp-core3  3.0.0
BppVector.h
Go to the documentation of this file.
1 //
2 // File: BppVector.h
3 // Authors:
4 // Julien Dutheil
5 // Francois Gindraud (2017)
6 // Created: 2008-04-07 15:14:00
7 // Last modified: 2017-06-27 00:00:00
8 //
9 
10 /*
11  Copyright or © or Copr. CNRS, (November 17, 2004)
12 
13  This software is a computer program whose purpose is to provide utilitary
14  classes. This file belongs to the Bio++ Project.
15 
16  This software is governed by the CeCILL license under French law and
17  abiding by the rules of distribution of free software. You can use,
18  modify and/ or redistribute the software under the terms of the CeCILL
19  license as circulated by CEA, CNRS and INRIA at the following URL
20  "http://www.cecill.info".
21 
22  As a counterpart to the access to the source code and rights to copy,
23  modify and redistribute granted by the license, users are provided only
24  with a limited warranty and the software's author, the holder of the
25  economic rights, and the successive licensors have only limited
26  liability.
27 
28  In this respect, the user's attention is drawn to the risks associated
29  with loading, using, modifying and/or developing or reproducing the
30  software by the user in light of its specific status of free software,
31  that may mean that it is complicated to manipulate, and that also
32  therefore means that it is reserved for developers and experienced
33  professionals having in-depth computer knowledge. Users are therefore
34  encouraged to load and test the software's suitability as regards their
35  requirements in conditions enabling the security of their systems and/or
36  data to be ensured and, more generally, to use and operate it in the
37  same conditions as regards security.
38 
39  The fact that you are presently reading this means that you have had
40  knowledge of the CeCILL license and that you accept its terms.
41 */
42 
43 #ifndef BPP_BPPVECTOR_H
44 #define BPP_BPPVECTOR_H
45 
46 #include <utility>
47 #include <vector>
48 
49 #include "Clonable.h"
50 
51 namespace bpp
52 {
57 template<typename T>
58 class BppVector :
59  public Clonable,
60  public std::vector<T>
61 {
62 public:
63  template<typename ... Args>
64  BppVector(Args&&... args) :
65  std::vector<T>(std::forward<Args>(args)...)
66  {}
67 
68  BppVector<T>* clone() const { return new BppVector<T>(*this); }
69 
70  const std::vector<T>& toSTL() const { return *this; }
71  std::vector<T>& toSTL() { return *this; }
72 };
73 } // namespace bpp
74 #endif // BPP_BPPVECTOR_H
The BppVector object class. This class extends the std::vector class to support the Clonable interfac...
Definition: BppVector.h:61
const std::vector< T > & toSTL() const
Definition: BppVector.h:70
BppVector(Args &&... args)
Definition: BppVector.h:64
BppVector< T > * clone() const
Create a copy of this object and send a pointer to it.
Definition: BppVector.h:68
std::vector< T > & toSTL()
Definition: BppVector.h:71
The Clonable interface (allow an object to be cloned).
Definition: Clonable.h:103