English document is under construction. Now, Japanese and English are written together. This library is a STL like containers. These containers never allocate memory dynamicaly. These containers' implementation is just an array. This library targets embedded programming.
#include <gslib/static_container/vector.h> using namespace gslib; using namespace static_container; vector< int, 10 > c; // int のベクター ( 最大サイズ 10 ) c.max_size(); // = 10 c.size(); // = 0 c.push_back( 5 ); // 5 を末尾に挿入 c.size(); // = 1 c.pop_back(); // 削除 c.size(); // = 0
現在、4バイトアラインにしか対応していない。
#include <gslib/static_container/list.h> using namespace gslib; using namespace static_container; list< int, 10 > c; // int のリスト ( 最大サイズ 10 ) c.max_size(); // = 10 c.size(); // = 0 c.push_back( 5 ); // 5 を末尾に挿入 c.size(); // = 1 c.pop_back(); // 削除 c.size(); // = 0
vector と違い、こいつはアライン問題は、大丈夫だと思う。
static_container::list_node_pool
#include <gslib/static_container/lodge_list.h> using namespace gslib; using namespace static_container; void test_lodge_list() { list_node_pool< int, 10 > pool; lodge_list< int > list0( pool ); lodge_list< int > list1( pool ); lodge_list< int > list2( pool ); pool.rest(); // = 10 初期状態では、10 個余っています list0.push_back( 100 ); // 100 を list0 に挿入 pool.rest(); // = 9 一つ減ります list0.front(); // = 100 もちろん、back も 100 になります }
現在、もっと良い名前を募集中!
#include <gslib/static_container/string.h> using namespace gslib; using namespace static_container; string< 10 > c; // 最大サイズ 10 の文字列 c.max_size(); // = 10 c.size(); // = 0 c.length(); // = 0 ( size() と同じ ) c.push_back( 5 ); // 5 を末尾に挿入 c.size(); // = 1 c.pop_back(); // 削除 c.size(); // = 0 "" == c; // = true ( C 文字列との比較 ) c < "a"; // = true ( C 文字列との辞書順比較 ) c = "hello"; // 文字列の代入 string< 100 > c100( c ); // 別の型への代入 c100 = c; c100 += c; c100.append( c );
static_container::list_hash
である。多くの場合、hash は list と組み合わせて使われることを想定しているため、最初からそれを組み合わせた list_hash というものも存在する。ほとんどの場合は、これを利用していれば、大きな問題に出会うことも無いであろう。
typedef list_hash< int, int, 10 > int_hash; int_hash ihash; ihash[ 0 ] = 100; ihash[ 5 ] = 20; ihash.size(); // = 2 ihash[ 0 ]; // = 100 ihash[ 5 ]; // = 20 ihash[ 5 ] = 30; 30 == ihash[ 5 ]; // = 30 ihash.size(); // = 2 すでにキーが存在する場合は、サイズが増えない
このライブラリは、boost に依存しています。
Copyright (C) 2004 &o
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
-----------------------------------------------------------------------------------------
商用利用していただいても、改変していただいても、結構です。謝辞は必要ありませんが、レスポンスがあるとうれしいのは言うまでもありません(^^)。一応 zlib/libpng ライセンスとしておきますが、&o に被害が及ばない範囲でのパブリックドメインであると考えていただいて、差し支えありません。そのため、ライセンスは随時よりゆるいものへ変えていっています。おそらく、ある日突然厳しいライセンスを求めるものになったりはしないと思います。安心してお使いください。
法的には、上記の原文のほうが有効なので、より厳密には日本語訳よりも原文を参考にしてください。日本語訳は、http://opensource.jp/licenses/zlib-license.html から頂いてきました。
zlib/libpngライセンス ( 日本語訳 )
Copyright (c) 2004 &o
本ソフトウェアは「現状のまま」で、明示であるか暗黙であるかを問わず、何らの保証もなく提供されます。本ソフトウェアの使用によって生じるいかなる損害についても、作者は一切の責任を負わないものとします。 以下の制限に従う限り、商用アプリケーションを含めて、本ソフトウェアを任意の目的に使用し、自由に改変して再頒布することをすべての人に許可します。