Const conversions for edict and kanjidic objects. Removal of obsolete dictionary...
[jben.git] / boosths.h
blobf1e287f6157aaeccaff197b3258d95e3e00eb325
1 /*
2 Project: J-Ben
3 Author: Paul Goins
4 Website: http://www.vultaire.net/software/jben/
5 License: GNU General Public License (GPL) version 2
6 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt)
8 File: boosths.h
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>
24 #ifndef boosths_h
25 #define boosths_h
27 #define BOOST_MULTI_INDEX_DISABLE_SERIALIZATION
29 #include <boost/multi_index_container.hpp>
30 #include <boost/multi_index/hashed_index.hpp>
31 #include <boost/multi_index/identity.hpp>
33 using namespace std;
34 using namespace boost;
35 using namespace boost::multi_index;
37 template<typename value>
38 class BoostHS : public
39 multi_index_container<
40 value,
41 indexed_by<
42 hashed_unique<
43 identity<value>
46 > {
47 public:
48 bool assign(const value& v);
49 private:
52 template<typename value>
53 bool BoostHS<value>::assign(const value& v) {
54 pair<typename BoostHS<value>::iterator, bool> p = this->insert(v);
55 if(!p.second) {
56 if(!this->replace(p.first, v)) return false;
58 return true;
61 #endif