// (C) Copyright 2010 Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk // (C) Copyright 2012 Vicente Botet // // 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) #define BOOST_THREAD_VERSION 4 #include #include #include void addTrailingSlashIfMissing(boost::synchronized_value & path) { boost::strict_lock_ptr u=path.synchronize(); if(u->empty() || (*u->rbegin()!='/')) { *u+='/'; } } void f(const boost::synchronized_value &v) { std::cout<<"v="<<*v< &v) { std::cout<<"v="<<*v< & path) { boost::strict_lock_ptr u=path.synchronize(); return (u->empty() || (*u->rbegin()!='/')); } int main() { { boost::synchronized_value v1; *v1=42; std::cout<<"v1="<<*v1<append("foo"); addTrailingSlashIfMissing(s); std::cout<<"s="<