// Copyright (c) 2009 GeometryFactory // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under // the terms of the Q Public License version 1.0. // See the file LICENSE.QPL distributed with CGAL. // // Licensees holding a valid commercial license may use this file in // accordance with the commercial license agreement provided with the software. // // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // $URL$ // $Id$ // // // Author(s) : Andreas Fabri #ifndef CGAL_PROPERTY_MAP_H #define CGAL_PROPERTY_MAP_H #include #include namespace CGAL { template struct identity_property_map : public boost::put_get_helper > { typedef T key_type; typedef T value_type; typedef T reference; typedef boost::readable_property_map_tag category; inline value_type operator[](const key_type& v) const { return v; } }; template struct first_of_pair_property_map : public boost::put_get_helper > { typedef Pair key_type; typedef typename Pair::first_type value_type; typedef typename Pair::first_type& reference; typedef boost::read_write_property_map_tag category; inline value_type operator[](const key_type& v) const { return v.first; } inline reference operator[](const key_type& v) { return v.first; } }; template struct nth_of_tuple_property_map : public boost::put_get_helper::type, nth_of_tuple_property_map > { typedef Tuple key_type; typedef typename boost::tuples::element::type value_type; typedef value_type& reference; typedef boost::read_write_property_map_tag category; }; }; namespace boost { template typename boost::tuples::element::type get(CGAL::nth_of_tuple_property_map pm, const Tuple& k) { return get(k); } template typename boost::tuples::element::type& get(CGAL::nth_of_tuple_property_map pm, Tuple& k) { return get(k); } template void put(CGAL::nth_of_tuple_property_map pm, Tuple& k, const typename boost::tuples::element::type& v) { get(k) = v; } } #endif // CGAL_PROPERTY_MAP_H