Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
testSnode.C
Go to the documentation of this file.
1
2/* Aleph-w
3
4 / \ | | ___ _ __ | |__ __ __
5 / _ \ | |/ _ \ '_ \| '_ \ ____\ \ /\ / / Data structures & Algorithms
6 / ___ \| | __/ |_) | | | |_____\ V V / version 1.9c
7 /_/ \_\_|\___| .__/|_| |_| \_/\_/ https://github.com/lrleon/Aleph-w
8 |_|
9
10 This file is part of Aleph-w library
11
12 Copyright (c) 2002-2018 Leandro Rabindranath Leon
13
14 Permission is hereby granted, free of charge, to any person obtaining a copy
15 of this software and associated documentation files (the "Software"), to deal
16 in the Software without restriction, including without limitation the rights
17 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18 copies of the Software, and to permit persons to whom the Software is
19 furnished to do so, subject to the following conditions:
20
21 The above copyright notice and this permission notice shall be included in all
22 copies or substantial portions of the Software.
23
24 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 SOFTWARE.
31*/
32
33# include <aleph.H>
34# include <tpl_snode.H>
35
36
37# define NumItems 10
38
39
40# include <iostream>
41
42using namespace std;
43
44int main()
45{
46 Snode<int> head;
47 unsigned i;
48 Snode<int> *node;
49 Snode<int> *aux;
50
51 for (i = 0; i < NumItems; i++)
52 {
53 node = new Snode<int> (i);
54 head.insert_next(node);
55 }
56
57 for (node = head.get_next(); node != &head; node = node->get_next())
58 {
59 cout << node->get_data() << " ";
60 }
61
62 while (not head.is_empty())
63 {
64 aux = head.remove_next();
65 delete aux;
66 }
67
68 printf("Ended\n");
69}
Core header for the Aleph-w library.
Singly linked node that stores data of type T.
Definition tpl_snode.H:66
T & get_data()
Return a modifiable reference to the stored data.
Definition tpl_snode.H:73
Snode *& get_next()
Return the next node after this.
Definition tpl_snode.H:96
Snode * remove_next()
Remove the node right after this and return it.
Definition tpl_snode.H:93
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
Definition Blossom.H:466
STL namespace.
#define NumItems
Definition testSnode.C:37
int main()
Definition testSnode.C:44
Typed singly linked node.