Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #14656

Re: #include and namespaces

Path csiph.com!aioe.org!news.mixmin.net!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date Thu, 01 Mar 2012 12:07:13 -0600
From Gareth Owen <gwowen@gmail.com>
Newsgroups comp.lang.c++
Subject Re: #include and namespaces
References <8266241.1084.1330590876018.JavaMail.geo-discussion-forums@vblb5> <jinri9$cet$1@dont-email.me> <jioc5q$h5i$1@dont-email.me>
Date Thu, 01 Mar 2012 18:07:31 +0000
Message-ID <8762eory8s.fsf@gmail.com> (permalink)
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)
Cancel-Lock sha1:XmBS7FmXr0Kvth8sygO5POSvfLM=
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Lines 35
X-Usenet-Provider http://www.giganews.com
X-Trace sv3-mpkRegoefVdrpxlVuQ8i4y8LtxZsoWI0aD9rYNRMMR2eY3JAWTxx1Y/ac68M7WD1zf/IpmJnJPMoX0R!Uq4dz42ogmyFoH3JbQgV0W3QB+XCFo7EcioxksbxuKSkCrnWLNHT3hxbkvnuriysEOQ=
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 1846
Xref csiph.com comp.lang.c++:14656

Show key headers only | View raw


yatremblay@bel1lin202.(none) (Yannick Tremblay) writes:

> However what are peoples opinion of specific using directives in
> headers, e.g.: "using std::string;".  Should they be absolutely
> rejected as with "using namespace" or is there any situation under
> which they are tolerable?


frob.hpp
--------
std::vector<std::string> tokenize(const std::string&);


frob.cpp
--------

std::vector<std::string> tokenize(const std::string& in)
{
  using std::string; 
  using std::vector;
  
  vector<string> tokens;
  while(something) {
     string tmp1 = foo(in);
     string tmp2 = bar(in);
     vector<string> parts;
     tokens.push_back(etc....);
     // more code     
     // ....
  }

  return tokens;
}

I can't see why that should be even slighty intolerable...

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

#include and namespaces Luca Cerone <luca.cerone@gmail.com> - 2012-03-01 00:34 -0800
  Re: #include and namespaces Victor Bazarov <v.bazarov@comcast.invalid> - 2012-03-01 07:54 -0500
    Re: #include and namespaces Luca Cerone <luca.cerone@gmail.com> - 2012-03-01 06:38 -0800
      Re: #include and namespaces Victor Bazarov <v.bazarov@comcast.invalid> - 2012-03-01 14:26 -0500
        Re: #include and namespaces Luca Cerone <luca.cerone@gmail.com> - 2012-03-02 00:47 -0800
    Re: #include and namespaces yatremblay@bel1lin202.(none) (Yannick Tremblay) - 2012-03-01 17:38 +0000
      Re: #include and namespaces Gareth Owen <gwowen@gmail.com> - 2012-03-01 18:07 +0000
        Re: #include and namespaces yatremblay@bel1lin202.(none) (Yannick Tremblay) - 2012-03-01 18:52 +0000
          Re: #include and namespaces Paavo Helde <myfirstname@osa.pri.ee> - 2012-03-01 15:13 -0600
      Re: #include and namespaces "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-03-01 19:07 +0100
        Re: #include and namespaces yatremblay@bel1lin202.(none) (Yannick Tremblay) - 2012-03-02 08:02 +0000
          Re: #include and namespaces "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-03-02 11:12 +0100
  Re: #include and namespaces Anand Hariharan <mailto.anand.hariharan@gmail.com> - 2012-03-01 11:20 -0800
    Re: #include and namespaces Victor Bazarov <v.bazarov@comcast.invalid> - 2012-03-01 14:30 -0500
      Re: #include and namespaces "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-03-01 20:53 +0100
        Re: #include and namespaces Miles Bader <miles@gnu.org> - 2012-03-02 09:51 +0900
        Re: #include and namespaces Daniel <danielaparker@gmail.com> - 2012-03-02 05:13 -0800
          Re: #include and namespaces Miles Bader <miles@gnu.org> - 2012-03-02 22:59 +0900
            Re: #include and namespaces Daniel <danielaparker@gmail.com> - 2012-03-02 10:31 -0800
              Re: #include and namespaces Miles Bader <miles@gnu.org> - 2012-03-03 10:54 +0900
              Re: #include and namespaces "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-03-03 08:53 +0100
  Re: #include and namespaces Juha Nieminen <nospam@thanks.invalid> - 2012-03-02 18:37 +0000
    Re: #include and namespaces Luca Cerone <luca.cerone@gmail.com> - 2012-03-03 04:22 -0800

csiph-web