Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59814 - sandbox/tokenmap/libs/tokenmap/example
From: sl_at_[hidden]
Date: 2010-02-21 12:31:05


Author: sl_
Date: 2010-02-21 12:31:05 EST (Sun, 21 Feb 2010)
New Revision: 59814
URL: http://svn.boost.org/trac/boost/changeset/59814

Log:
fixed sample filename
Added:
   sandbox/tokenmap/libs/tokenmap/example/simple_tokenmap.cpp
      - copied unchanged from r59812, /sandbox/tokenmap/libs/tokenmap/example/simple_bimap.cpp
Removed:
   sandbox/tokenmap/libs/tokenmap/example/simple_bimap.cpp

Deleted: sandbox/tokenmap/libs/tokenmap/example/simple_bimap.cpp
==============================================================================
--- sandbox/tokenmap/libs/tokenmap/example/simple_bimap.cpp 2010-02-21 12:31:05 EST (Sun, 21 Feb 2010)
+++ (empty file)
@@ -1,60 +0,0 @@
-// Boost.Tokenmap
-//
-// Copyright (c) 2009 Slawomir Lisznianski
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// VC++ 8.0 warns on usage of certain Standard Library and API functions that
-// can cause buffer overruns or other possible security issues if misused.
-// See http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
-// But the wording of the warning is misleading and unsettling, there are no
-// portable alternative functions, and VC++ 8.0's own libraries use the
-// functions in question. So turn off the warnings.
-#define _CRT_SECURE_NO_DEPRECATE
-#define _SCL_SECURE_NO_DEPRECATE
-
-// Boost.Tokenmap Example
-//-----------------------------------------------------------------------------
-
-#include <boost/config.hpp>
-
-//[ code_simple_tokenmap
-
-#include <boost/tokenmap.hpp>
-
-// holds session information (ie. connected client's context)
-struct session { };
-
-int main()
-{
- typedef boost::tokenmap<session, uint32_t> tokenamp_type;
-
- tokenamp_type sessions(2000, // hint on number of concurrent sessions
- 0.7, // load factor, if exceeded, the container resizes
- time(NULL) // seed for the pseudo-random number generator
- );
-
- // insert by-value; on return v1 holds a std::pair<token, session*>
- tokenamp_type::value_type v1 =
- sessions.insert( session() );
-
- // insert by-auto_ptr
- tokenamp_type::value_type v2 =
- sessions.insert( std::auto_ptr<session>(new session()) );
-
- // search for session instance
- tokenamp_type::mapped_type * m1 = sessions.find( v1.first );
-
- // pop (remove) element from the container
- std::auto_ptr<map_type::mapped_type> e1 =
- sessions.pop( v1.first );
-
- // checks if element identified by token exists
- bool found = sessions.exists( v1.first );
-
- return 0;
-}
-//]
-


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk