Added boost header

This commit is contained in:
Christophe Riccio
2012-01-08 01:26:07 +00:00
parent 9c3faaca40
commit c7d752cdf8
8946 changed files with 1732316 additions and 0 deletions

View File

@@ -0,0 +1,170 @@
// Boost.Bimap
//
// Copyright (c) 2006-2007 Matias Capeletto
//
// 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)
/// \file relation/detail/access_builder.hpp
/// \brief Define macros to help building metafunctions
#ifndef BOOST_BIMAP_RELATION_ACCESS_BUILDER_HPP
#define BOOST_BIMAP_RELATION_ACCESS_BUILDER_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/relation/support/member_with_tag.hpp>
#include <boost/bimap/relation/member_at.hpp>
#include <boost/call_traits.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/not.hpp>
#include <boost/utility/enable_if.hpp>
/******************************************************************************
BIMAP SYMMETRIC ACCESS RESULT OF
*******************************************************************************
namespace result_of {
template< class Tag, class SymmetricType >
struct NAME
{
typedef -unspecified- type;
};
} // namespace result_of
******************************************************************************/
/*===========================================================================*/
#define BOOST_BIMAP_SYMMETRIC_ACCESS_RESULT_OF_BUILDER( \
\
NAME, \
METAFUNCTION_BASE \
) \
\
namespace result_of { \
\
template< class Tag, class SymmetricType > \
struct NAME \
{ \
typedef BOOST_DEDUCED_TYPENAME METAFUNCTION_BASE \
< \
Tag,SymmetricType \
\
>::type value_type; \
\
typedef BOOST_DEDUCED_TYPENAME mpl::if_< is_const<SymmetricType>, \
\
BOOST_DEDUCED_TYPENAME call_traits<value_type>::const_reference, \
\
BOOST_DEDUCED_TYPENAME call_traits<value_type>::reference \
\
>::type type; \
}; \
\
}
/*===========================================================================*/
/******************************************************************************
BIMAP SYMMETRIC ACCESS IMPLEMENTATION
*******************************************************************************
namespace detail {
template< class Tag, class SymmetricType >
typename result_of::NAME<Tag,SymmetricType>::type
NAME( Tag , const Relation & );
} // namespace detail
******************************************************************************/
/*===========================================================================*/
#define BOOST_BIMAP_SYMMETRIC_ACCESS_IMPLEMENTATION_BUILDER( \
\
NAME, \
TP_SYMMETRIC, \
PARAMETER_NAME, \
LEFT_BODY, \
RIGHT_BODY \
) \
\
namespace detail { \
\
\
\
template< class TP_SYMMETRIC > \
BOOST_DEDUCED_TYPENAME result_of::NAME \
< \
::boost::bimaps::relation::member_at::left,TP_SYMMETRIC \
\
>::type \
\
NAME( ::boost::bimaps::relation::member_at::left, \
TP_SYMMETRIC & PARAMETER_NAME ) \
{ \
LEFT_BODY; \
} \
\
template< class TP_SYMMETRIC > \
BOOST_DEDUCED_TYPENAME result_of::NAME \
< \
::boost::bimaps::relation::member_at::right,TP_SYMMETRIC \
\
>::type \
\
NAME( ::boost::bimaps::relation::member_at::right, \
TP_SYMMETRIC & PARAMETER_NAME ) \
{ \
RIGHT_BODY; \
} \
\
}
/*===========================================================================*/
/******************************************************************************
BIMAP RELATION ACCESS INTERFACE
*******************************************************************************
template< class Tag, class SymmetricType >
typename result_of::NAME<Tag,SymmetricType>::type
NAME( const SymmetricType & );
******************************************************************************/
/*===========================================================================*/
#define BOOST_BIMAP_SYMMETRIC_ACCESS_INTERFACE_BUILDER( \
\
NAME \
) \
\
template< class Tag, class SymmetricType > \
BOOST_DEDUCED_TYPENAME result_of::NAME<Tag,SymmetricType>::type \
NAME( SymmetricType & s ) \
{ \
typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support:: \
member_with_tag \
< \
Tag,SymmetricType \
\
>::type member_at_tag; \
\
return detail::NAME(member_at_tag(),s); \
}
/*===========================================================================*/
#endif // BOOST_BIMAP_RELATION_ACCESS_BUILDER_HPP

View File

@@ -0,0 +1,103 @@
// Boost.Bimap
//
// Copyright (c) 2006-2007 Matias Capeletto
//
// 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)
/// \file relation/detail/metadata_access_builder.hpp
/// \brief Define macros to help building metafunctions
#ifndef BOOST_BIMAP_RELATION_DETAIL_METADATA_ACCESS_BUILDER_HPP
#define BOOST_BIMAP_RELATION_DETAIL_METADATA_ACCESS_BUILDER_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/relation/support/is_tag_of_member_at.hpp>
#include <boost/bimap/detail/debug/static_error.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/preprocessor/cat.hpp>
/******************************************************************************
BIMAP SYMMETRIC METADATA ACCESS INTERFACE
*******************************************************************************
template< class Tag, class SymmetricType >
struct NAME
{
typedef -unspecified- type;
};
******************************************************************************/
/*===========================================================================*/
#define BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER( \
\
NAME, \
METADATA_BY_LEFT, \
METADATA_BY_RIGHT \
) \
\
template \
< \
class Tag, \
class SymmetricType, \
class Enable = void \
> \
struct NAME \
{ \
BOOST_BIMAP_STATIC_ERROR( \
BOOST_PP_CAT(NAME,_FAILURE), \
(SymmetricType,Tag) \
); \
}; \
\
template< class Tag, class SymmetricType > \
struct NAME \
< \
Tag, SymmetricType, \
BOOST_DEDUCED_TYPENAME enable_if \
< \
::boost::bimaps::relation::support::is_tag_of_member_at_left \
< \
Tag, \
SymmetricType \
> \
\
>::type \
> \
{ \
typedef BOOST_DEDUCED_TYPENAME SymmetricType::METADATA_BY_LEFT type; \
}; \
\
template< class Tag, class SymmetricType > \
struct NAME \
< \
Tag, SymmetricType, \
BOOST_DEDUCED_TYPENAME enable_if \
< \
::boost::bimaps::relation::support::is_tag_of_member_at_right \
< \
Tag, \
SymmetricType \
> \
\
>::type \
> \
{ \
typedef BOOST_DEDUCED_TYPENAME SymmetricType::METADATA_BY_RIGHT type; \
};
/*===========================================================================*/
#endif // BOOST_BIMAP_RELATION_DETAIL_METADATA_ACCES_BUILDER_HPP

View File

@@ -0,0 +1,83 @@
// Boost.Bimap
//
// Copyright (c) 2006-2007 Matias Capeletto
//
// 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)
/// \file relation/detail/mutant.hpp
/// \brief Mutate functions to extract views of mutant classes.
#ifndef BOOST_BIMAP_RELATION_DETAIL_MUTANT_HPP
#define BOOST_BIMAP_RELATION_DETAIL_MUTANT_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/detail/debug/static_error.hpp>
#include <boost/mpl/contains.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/utility.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/mpl/not.hpp>
#include <boost/utility/enable_if.hpp>
namespace boost {
namespace bimaps {
namespace relation {
/// \brief Relation details, mutant idiom and symmetrical metafunctions builders.
namespace detail {
//@{
/// \brief Converts a mutant class to a view with zero overhead.
/**
This function is a safe wrapper around reinterpret_cast. It checks at
compile time that the desired view is supported by the mutant class.
See also mutant, can_mutate_in.
\ingroup mutant_group
**/
template< class View, class Type >
BOOST_DEDUCED_TYPENAME enable_if< mpl::not_< is_const< Type > >,
View&
>::type mutate( Type & m )
{
BOOST_MPL_ASSERT((
::boost::mpl::contains<BOOST_DEDUCED_TYPENAME Type::mutant_views,View>
));
return *reinterpret_cast< View* >(boost::addressof(m));
}
template< class View, class Type >
BOOST_DEDUCED_TYPENAME enable_if< is_const< Type >,
const View&
>::type mutate( Type & m )
{
BOOST_MPL_ASSERT((
::boost::mpl::contains<BOOST_DEDUCED_TYPENAME Type::mutant_views,View>
));
return *reinterpret_cast< const View* >(boost::addressof(m));
}
//@}
} // namespace detail
} // namespace relation
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_RELATION_DETAIL_MUTANT_HPP

View File

@@ -0,0 +1,105 @@
// Boost.Bimap
//
// Copyright (c) 2006-2007 Matias Capeletto
//
// 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)
/// \file relation/detail/static_access_builder.hpp
/// \brief Define macros to help building metafunctions
#ifndef BOOST_BIMAP_RELATION_DETAIL_STATIC_ACCESS_BUILDER_HPP
#define BOOST_BIMAP_RELATION_DETAIL_STATIC_ACCESS_BUILDER_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/relation/support/is_tag_of_member_at.hpp>
#include <boost/bimap/detail/debug/static_error.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/preprocessor/cat.hpp>
/******************************************************************************
BIMAP SYMMETRIC STATIC ACCESS INTERFACE
*******************************************************************************
template< class Tag, class SYMETRIC_TYPE >
struct NAME
{
-UNDEFINED BODY-;
};
******************************************************************************/
/*===========================================================================*/
#define BOOST_BIMAP_SYMMETRIC_STATIC_ACCESS_BUILDER( \
\
NAME, \
SYMMETRIC_TYPE, \
LEFT_BODY, \
RIGHT_BODY \
) \
\
template \
< \
class Tag, \
class SYMMETRIC_TYPE, \
class Enable = void \
> \
struct NAME \
{ \
BOOST_BIMAP_STATIC_ERROR( \
BOOST_PP_CAT(NAME,_FAILURE), \
(SYMMETRIC_TYPE,Tag) \
); \
}; \
\
template< class Tag, class SYMMETRIC_TYPE > \
struct NAME \
< \
Tag, SYMMETRIC_TYPE, \
BOOST_DEDUCED_TYPENAME enable_if \
< \
::boost::bimaps::relation::support::is_tag_of_member_at_left \
< \
Tag, \
SYMMETRIC_TYPE \
> \
\
>::type \
> \
{ \
LEFT_BODY; \
}; \
\
template< class Tag, class SYMMETRIC_TYPE > \
struct NAME \
< \
Tag, SYMMETRIC_TYPE, \
BOOST_DEDUCED_TYPENAME enable_if \
< \
::boost::bimaps::relation::support::is_tag_of_member_at_right \
< \
Tag, \
SYMMETRIC_TYPE \
> \
\
>::type \
> \
{ \
RIGHT_BODY; \
};
/*===========================================================================*/
#endif // BOOST_BIMAP_RELATION_DETAIL_STATIC_ACCES_BUILDER_HPP

View File

@@ -0,0 +1,102 @@
// Boost.Bimap
//
// Copyright (c) 2006-2007 Matias Capeletto
//
// 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)
/// \file relation/detail/to_mutable_relation_functor.hpp
/// \brief functors to convert types to mutable relations
#ifndef BOOST_BIMAP_RELATION_DETAIL_TO_MUTABLE_RELATION_FUNCTOR_HPP
#define BOOST_BIMAP_RELATION_DETAIL_TO_MUTABLE_RELATION_FUNCTOR_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/relation/support/pair_type_by.hpp>
#include <boost/bimap/relation/detail/mutant.hpp>
#include <boost/bimap/relation/mutant_relation.hpp>
namespace boost {
namespace bimaps {
namespace relation {
namespace detail {
/// \brief Functor used in map views
template< class Tag, class Relation >
struct pair_to_relation_functor
{
const Relation
operator()(const BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
pair_type_by<Tag,Relation>::type & p) const
{
return Relation(p);
}
};
template< class Tag, class TA, class TB, class Info >
struct pair_to_relation_functor<
Tag,::boost::bimaps::relation::mutant_relation<TA,TB,Info,true> >
{
typedef ::boost::bimaps::relation::mutant_relation<TA,TB,Info,true> Relation;
Relation &
operator()( BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
pair_type_by<Tag,Relation>::type & p ) const
{
return ::boost::bimaps::relation::detail::mutate<Relation>(p);
}
const Relation &
operator()( const BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
pair_type_by<Tag,Relation>::type & p) const
{
return ::boost::bimaps::relation::detail::mutate<Relation>(p);
}
};
/// \brief Used in set views
template< class Relation >
struct get_mutable_relation_functor
{
const Relation
operator()( const BOOST_DEDUCED_TYPENAME Relation::above_view & r ) const
{
return Relation(r);
}
};
template< class TA, class TB, class Info >
struct get_mutable_relation_functor< ::boost::bimaps::relation::mutant_relation<TA,TB,Info,true> >
{
typedef ::boost::bimaps::relation::mutant_relation<TA,TB,Info,true> Relation;
Relation &
operator()( BOOST_DEDUCED_TYPENAME Relation::above_view & r ) const
{
return ::boost::bimaps::relation::detail::mutate<Relation>(r);
}
const Relation &
operator()( const BOOST_DEDUCED_TYPENAME Relation::above_view & r ) const
{
return ::boost::bimaps::relation::detail::mutate<Relation>(r);
}
};
} // namespace detail
} // namespace relation
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_RELATION_DETAIL_TO_MUTABLE_RELATION_FUNCTOR_HPP