MADNESS  version 0.9
vector_factory.h
Go to the documentation of this file.
1 /*
2  This file is part of MADNESS.
3 
4  Copyright (C) 2007,2010 Oak Ridge National Laboratory
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 
20  For more information please contact:
21 
22  Robert J. Harrison
23  Oak Ridge National Laboratory
24  One Bethel Valley Road
25  P.O. Box 2008, MS-6367
26 
27  email: harrisonrj@ornl.gov
28  tel: 865-241-3937
29  fax: 865-572-0680
30 
31 
32  $Id$
33 */
34 
35 
36 #ifndef MADNESS_TENSOR_VECTOR_FACTORY_H__INCLUDED
37 #define MADNESS_TENSOR_VECTOR_FACTORY_H__INCLUDED
38 
39 #include <vector>
40 
43 
45 
46 namespace madness {
47 
49  template <typename T>
50  inline std::vector<T> vector_factory(const T& v0) {
51  std::vector<T> v(1);
52  v[0] = v0;
53  return v;
54  }
55 
57  template <typename T>
58  inline std::vector<T> vector_factory(const T& v0, const T& v1) {
59  std::vector<T> v(2);
60  v[0] = v0;
61  v[1] = v1;
62  return v;
63  }
64 
66  template <typename T>
67  inline std::vector<T> vector_factory(const T& v0, const T& v1,
68  const T& v2) {
69  std::vector<T> v(3);
70  v[0] = v0;
71  v[1] = v1;
72  v[2] = v2;
73  return v;
74  }
75 
77  template <typename T>
78  inline std::vector<T> vector_factory(const T& v0, const T& v1,
79  const T& v2, const T& v3) {
80  std::vector<T> v(4);
81  v[0] = v0;
82  v[1] = v1;
83  v[2] = v2;
84  v[3] = v3;
85  return v;
86  }
87 
89  template <typename T>
90  inline std::vector<T> vector_factory(const T& v0, const T& v1,
91  const T& v2, const T& v3,
92  const T& v4) {
93  std::vector<T> v(5);
94  v[0] = v0;
95  v[1] = v1;
96  v[2] = v2;
97  v[3] = v3;
98  v[4] = v4;
99  return v;
100  }
101 
103  template <typename T>
104  inline std::vector<T> vector_factory(const T& v0, const T& v1,
105  const T& v2, const T& v3,
106  const T& v4, const T& v5) {
107  std::vector<T> v(6);
108  v[0] = v0;
109  v[1] = v1;
110  v[2] = v2;
111  v[3] = v3;
112  v[4] = v4;
113  v[5] = v5;
114  return v;
115  }
116 }
117 
118 #endif // MADNESS_TENSOR_VECTOR_FACTORY_H__INCLUDED
const T1 &f1 return GTEST_2_TUPLE_() T(f0, f1)
std::vector< T > vector_factory(const T &v0)
Returns a std::vector initialized from the arguments.
Definition: vector_factory.h:50
Holds machinery to set up Functions/FuncImpls using various Factories and Interfaces.
Definition: chem/atomutil.cc:45