Yurttas/PL/OOL/Cplusplus/F/05/01/03/02/T V.cpp

From ZCubes Wiki
Revision as of 22:42, 6 November 2013 by MassBot1 (talk | contribs) (Created page with "<syntaxhighlight lang="cpp" line start="1" enclose="div">/* Copyright(C) 1998 All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc.. Perm...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
 1/*
 2   Copyright(C) 1998
 3   All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4
 5   Permission to use, copy, modify, and distribute this
 6   software and its documentation for EDUCATIONAL purposes
 7   and without fee is hereby granted provided that this
 8   copyright notice appears in all copies.
 9
10   date   : January 1, 1998.
11   author : Salih Yurttas.
12
13   T_V.cpp
14*/
15
16
17#include "T_V.h"
18
19template<class T>
20T_V<T>::
21T_V() {
22}
23
24template<class T>
25T_V<T>::
26T_V(const T_V<T>& o) : d(o.d) {
27}
28
29template<class T>
30T_V<T>&
31T_V<T>::
32operator=(const T_V<T>& o) {
33  if(this==&o) return *this;
34
35  d = o.d;
36
37  return *this;
38}
39
40template<class T>
41int
42T_V<T>::
43get_size() const {
44  return d.size();
45}
46
47template<class T>
48T
49T_V<T>::
50get_d(const int index) const {
51  return d.at(index);
52}
53
54template<class T>
55vector<T>
56T_V<T>::
57get_d() const {
58  return d;
59}
60
61template<class T>
62void
63T_V<T>::
64set_d(const int size) {
65  vector<T> t(size);
66  d = t;
67}
68
69template<class T>
70void
71T_V<T>::
72set_d(const int index,
73      const T value) {
74  d.at(index) = value;
75}
76
77template<class T>
78ostream& operator<<(ostream& os,
79                    const T_V<T>& o) {
80  int n = o.d.size();
81  for(int i=0; i<n; i++)
82    os << o.d.at(i) << endl;
83
84  return os;
85}